Hi everyone, I have created 2 style sheets, one for IE version 6 and previous (called oldstyle_ie.css) and one for IE 7 and Firefox (called style.css) I have used JavaScript (see below) to load the CSS file but I am having a problem with oldstyle_ie.css as it's not being loaded Also please find a link for a testing webpage http://test.amaze.com.mt/ Any help please Thanks in advance ziffa27 <SCRIPT LANGUAGE = "JavaScript"> <!-- 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" />'); if (browser == 'IE' && version > 6) document.write('<'+'link rel="stylesheet" href="style.css" />'); if (browser == 'Netscape' && version >= 2.02) document.write('<'+'link rel="stylesheet" href=" style.css" />'); // --> </SCRIPT>
You were already given an answer. You don't need JavaScript for this, just a conditional comment. except that the logic of: <!--[if !lte IE 6]>IE7 / FF stylesheet<![endif]--> HTML: is incorrect. FF doesn't read conditional comments. The best way to do what you want is to have one general stylesheet, then send a separate one to browsers as needed, to overrule the master sheet.