Giving in to JavaScript

December 2nd, 2003

After wasting too much time scouring the internet for a way of positioning things accurately in Firebird/Mozilla and IE using only CSS, I've given in and gone for using two separate CSS files, with the following lines of JavaScript to direct the browser to the appropriate file:

var browser;

if (navigator.appName.indexOf('Netscape') != -1) {
    document.write('<'+'link rel="stylesheet"
      href="css/FirebirdCompatible.css" />');
}
else {
    document.write('<'+'link rel="stylesheet"
      href="css/IEcompatible.css" />');
}

OK, so I've given in. But at least now I can get on and finish off the page, which has been languishing, three-quarters-done, for about a week now. ITauthor.com will then, finally, have a proper home page.


NOTE

In case you're wondering how I styled the code above (in other words, for my own benefit when I want to do the same thing in a few weeks time and can't remember what I did). I just typed in an inline style in the normal MovableType input box.

For more details about inline CSS, take a look at:
http://www.alabamatechnologies.com/resources/css-09.asp

Potentially similar posts

Leave a comment