What is the syntax if I want to load a css file in my website with if statement.
Situation is like this.
If ie6 I will load ie6_style.css
and if ie7, mozilla, or new browsers, I will load style.css
What is the syntax if I want to load a css file in my website with if statement.
Situation is like this.
If ie6 I will load ie6_style.css
and if ie7, mozilla, or new browsers, I will load style.css
You would need to detect which browser with javascript and then load the CSS.
Something like this
<script language="JavaScript"><!--
browser_version= parseInt(navigator.appVersion);
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 7)) {
document.write("<link REL='stylesheet' HREF='012899-ie7.css' TYPE='text/css'>");
}
else if (browser_type == "Netscape" && (browser_version >= 5)) {
document.write("<link REL='stylesheet' HREF='012899-netscape5.css' TYPE='text/css'>");
}
// --></script>
<link rel="stylesheet" type="text/css" href="style.css">
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6_style.css">
<![endif]-->