SN1P3R_85 Posted November 15, 2008 Share Posted November 15, 2008 This isn't really a php question, but im tired of posting on the javascript page and having to wait an hour till i even get a single reply. Im sure many of you know javascript if you know php. In a code, i am calling different css files based on the browser type. What it does so far is call the css file, but doesn't execute any of the html, so i get a background color, and thats it. I call the js function in the body tag: <body onLoad="check_brwz();"> here is the javascript code: <script type="text/javascript"> <!-- function check_brwz() //checks for browser type so it will apply the correct style format { function browser() //sets browser name and version { this.name = navigator.appName; this.version = navigator.appVersion; } browse = new browser(); if (browse.name == 'Netscape') //sets the correct style format { document.write('<link rel="stylesheet" type="text/css" href="/css/moz_main.css" />'); document.write("hello"); } else if (browse.name == 'Microsoft Internet Explorer') { document.write('<link rel="stylesheet" type="text/css" href="/css/ie_main.css" />'); } else if (browse.name == 'Opera') { document.write('<link rel="stylesheet" type="text/css" href="/css/opera_main.css" />'); } else //default style format if browser type is unkown { alert('your browser is too old or unkown, settings will be set by default to fit Mozilla'); document.write('<link rel="stylesheet" type="text/css" href="/css/moz_main.css" />'); } alert(browse.name); } //--> </script> Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted November 15, 2008 Author Share Posted November 15, 2008 c'mon, are u telling me that none of you can help me with this problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.