I'm trying to write a stylesheet switcher. What should happen in this switcher is that, on page load, it will detect whether you are using Internet Explorer or another browser, and then it will load the appropriate stylesheet.
This is what i've got so far:
PHP Code:
//Stylesheet Switcher
if (navigator.appName = Microsoft Internet Explorer) {
document.write("styleIE.css")
}
else {
document.write("style.css")
}
i'm not sure how to tell it to put "style.css" or "styleIE.css" in the appropriate location, which would be in the header like so:
Don't look a gift-hourse in the mouth. I wasn't trying to correct your logic. I was only solving the specific question asked ... how to use document.write in order to specify a stylesheet selection.
You must remember though that not all users have JavaScript available, so this will fail about 1 in 10 times. Further, CSS alone can get the job done by working around the quirks presented by Microsoft's joke of a browser.
You must remember though that not all users have JavaScript available, so this will fail about 1 in 10 times.
If you were paying attention, there were NOSCRIPT tags used to provide a default style sheet in that case.
But, yes, a CSS-only solution would be better.
I wouldn't call a product a joke that has the ability to command most of the browser market. It must have SOME redeeming quality that makes it the most popular.
I wouldn't call a product a joke that has the ability to command most of the browser market. It must have SOME redeeming quality that makes it the most popular.
Um, it's installed by default on Windows? Oh yeah, that's it. It's nothing more than a security hole that can't understand HTML or JavaScript. Thankfully, Mozilla is getting more and more mainstream.
It doesn't matter if it is installed by default with Windows. Any product not worth it's weight in gold will be ignored and a rival product installed for use instead. That's the nature of market competition. I'm not the biggest fan of IE, but neither Mozilla nor any other browser will ever surpass IE. People are not a stupid as you (or those like you) would make them out to be.
Last edited by phpnovice; 06-07-2005 at 11:40 PM.
Reason: grammar
I'm not the biggest fan of IE, but neither Mozilla nor any other browser will never surpass IE.
Too late, Mozilla and Opera are already lightyears ahead of IE in terms of DOM (Level 2, I might add) support, CSS2 and even a few neat tricks from CSS3. When you factor in how much more secure these two browsers are, not to mention far superior usability (e.g., tabbed browsing)... you realize how false your statement really is. The only way someone could support IE is they are 1) a Microsoft fanboy, or 2) a Microsoft employee (and even that's not always true, consdering many Microsoft employees have admitted to using Firefox).
Too late, Mozilla and Opera are already lightyears ahead of IE in terms of DOM (Level 2, I might add) support...
Surely you're not really that dense? When I said "surpass" I was talking about market share. Sheesh!
Otherwise, no, I'm not a big fan of IE -- even though I prefer the flexibility of IE over any other browser (by market share, I'm in good company there). I just can't stand those who bad-mouth things about which they don't really know what they're talking about. Where software is concerned, all of it has its share of problems. People who focus on one company's software problems are just picking on the big target because it's easy. Such people are merely hungry for the aggrandizement of fellowshipping with others who share their predilection for bottom-feeding. Eventually, maybe, such people will grow up and get a life of their own so that they don't have to vicariously share in the lives of others through common fallacious hypotheses.
But, that's OK. You just go right on ahead. I know when I'm talking to a brick wall. Besides, we are all entitled to our own opinions. Eh?
Bookmarks