Topic: Style switching doesn't work in IE (Page 1 of 1) |
|
|---|---|
|
Bipolar (III) Inmate From: College Station, TX |
posted 04-21-2006 19:36
I took the code from the ALA article on style switchers and just added a check for windowwidth at the top. I do not really know javascript, but I was able to hack together this solution which works perfect in Firefox. I cannot however, figure out why IE doesn't like it. code: var windowWidth = window.innerWidth;
if ( windowWidth < 810 ) setActiveStyleSheet('smallWidth');
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
|
|
Paranoid (IV) Inmate From: Maryland, USA |
posted 04-21-2006 22:37
http://www.javascripter.net/faq/browserw.htm |
|
Bipolar (III) Inmate From: College Station, TX |
posted 04-21-2006 22:50
You are my new favorite person. You win TWO internets. |