Search This Blog
Tuesday, October 20, 2009
Javascript to assign CSS on the basis of browser
<script language="JavaScript"><br /><!-- var browser = ''; var version = ''; var entrance = ''; var cond = ''; // BROWSER? if (browser == ''){ if (navigator.appName.indexOf('Microsoft') != -1) browser = 'IE' else if (navigator.appName.indexOf('Netscape') != -1) browser = 'Netscape' else browser = 'IE'; } if (version == ''){ version= navigator.appVersion; paren = version.indexOf('('); whole_version = navigator.appVersion.substring(0,paren-1); version = parseInt(whole_version); } //if (browser == 'IE' && version <= 6) document.write('<'+'link rel="stylesheet" href="oldstyle_ie.css" />');<br />if (browser == 'IE' && version > 6) document.write('<'+'link rel="stylesheet" href="css/ie7.css" />');<br />else document.write('<'+'link rel="stylesheet" href="css/white-master.css" media="screen, projection" />');<br />//if (browser == 'Netscape' && version >= 2.02) document.write('<'+'link rel="stylesheet" href=" style.css" />');<br />// --><br /></script>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment