Code Snippets

  

ColdFusion Source Code


Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,107 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,140 people online right now. Registration is fast and FREE... Join Now!





GetScreenProp.cfm

custom tag used to load css based on screen resolution, operating system, and browser

Submitted By: wiredwizard
Actions:
Rating:
Views: 1,194

Language: ColdFusion

Last Modified: May 7, 2005
Instructions: will need style sheet for all of following
ie 800x600 = global.css
ie 1024 = globallg.css
netscape 800 = nglobal.css
and so forth

Snippet


  1. <script language="JavaScript" type="text/JavaScript">
  2. var screen_width = screen.width;
  3. var myflag = false
  4. if(navigator.appName == "Microsoft Internet Explorer" && screen_width <= 800 && navigator.appVersion.indexOf("Win")!=-1) {
  5.       document.write("<link href=\"global.css\" rel=\"stylesheet\" type=\"text/css\" />");
  6.       myflag = true;
  7. }
  8.  
  9. if(navigator.appName == "Microsoft Internet Explorer" && screen_width >= 1024 && navigator.appVersion.indexOf("Win")!=-1) {
  10.       document.write("<link href=\"globalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
  11.       myflag = true;
  12. }
  13.  
  14. if(navigator.appName == "Netscape" && screen_width <= 824 && navigator.appVersion.indexOf("Win")!=-1) {
  15.       document.write("<link href=\"nglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
  16.       myflag = true;
  17. }
  18.  
  19.  
  20. if(navigator.appName == "Netscape" && screen_width >= 1024 && navigator.appVersion.indexOf("Win")!=-1) {
  21.       document.write("<link href=\"nglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
  22.       myflag = true;
  23. }
  24.  
  25. if(navigator.appName == "Microsoft Internet Explorer" && screen_width <= 820 && navigator.appVersion.indexOf("Mac")!=-1) {
  26.       document.write("<link href=\"macglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
  27.       myflag = true;
  28. }
  29.  
  30. if(navigator.appName == "Microsoft Internet Explorer" && screen_width >= 1024 && navigator.appVersion.indexOf("Mac")!=-1) {
  31.       document.write("<link href=\"macglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
  32.       myflag = true;
  33. }
  34.  
  35. if(navigator.appName == "Netscape" && screen_width <= 824 && navigator.appVersion.indexOf("Mac")!=-1) {
  36.       document.write("<link href=\"macnglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
  37.       myflag = true;
  38. }
  39.  
  40.  
  41. if(navigator.appName == "Netscape" && screen_width >= 1024 && navigator.appVersion.indexOf("Mac")!=-1) {
  42.       document.write("<link href=\"macnglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
  43.       myflag = true;
  44. }
  45.  
  46. if (myflag == false) {
  47.       document.write("<link href=\"global.css\" rel=\"stylesheet\" type=\"text/css\" />");
  48. }
  49.  
  50. </script>

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month