Click to See Complete Forum and Search --> : change the css file with javascript?


haynbrian
07-19-2003, 02:23 PM
Hello all,

I am wondering if I would be able to change which css file the browser reads depending on the browser that is viewing the document.

For example, lets say someone is viewing the document with netscape. Since they are seeing the page with netscape, the javascript would run the file "netscape.css". Further, if they are viewing the document with IE, the javascript would run the "ie.css" file.

Is this possible?

Thanks,

Brian

Exuro
07-19-2003, 02:54 PM
You coud do something like this:


if (navigator.appName=="Microsoft Internet Explorer") {
document.writeln('<link rel="stylesheet" type="text/css" href="ie.css" />');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="netscape.css" />');
}