This is my first post here, and I now next to nothing about javascript, so I’m not entirely sure if what I’m trying to do is indeed possible.
I have an html file that uses and external CSS style sheet. However, people using the latest Firefox versions were unable to see the images of my website. So I’ve made another CSS style sheet that works perfectly with the latest versions of Firefox. Now I have 2 external CSS style sheets, one that works with most browsers and one just for Mozilla.
I’m trying to use javascript in my html file to make my page detect the user’s browser and display the apropriate style sheet using an “If… else…” command. Is it possible to direct to a CSS style sheet using javascript?
<HEAD>
<script type=”text/javascript” language=”JavaScript” src=”DHTMLMenuExpanderV2.js”></script>
<script type=”text/javascript” language=”JavaScript” src=”EditMeVsample2.js”></script>
<LINK rel=”stylesheet” type=”text/css” href=”DMEVerticalIE.css”>
<LINK rel=”stylesheet” type=”text/css” href=”DMEVertical1.css”>
<script type=”text/javascript”>
function detectBrowser()
{
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
if ((browser==”Netscape”||browser==”Microsoft Internet Explorer”))
{document.getElementById(‘IE’)}
else
{document.getElementById(‘menuSystem’)}
}
</script>
I have ommited a part of the header that I don’t think that has anything to do with the problem.
I was trying to set a name for each style sheet, so that I could direct the javascript to them, but I wasn’t even able to do that…
Any help would be hugely appreciated.
Thanks a lot!
davidaviola