By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

changing active sytlesheet

P: n/a
I'm trying out the code from alistapart
<url:http://www.alistapart.com/articles/alternate/> to change the
current stylesheet:

function setActiveStyleSheet(title) {
var a;
for( var 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;
}
}
}

If I put an 'alert' in it tells me that the selected stylesheet is
indeed now enabled (not disabled) but the page doesn't reflect any
change. The stylesheets each have just one selector (so I can test it's
working):
body { font-size: 150%; }
body { font-size: 200%; }
....

It does nothing in both MZ 1.7.5 and IE 6. Is there some 'trick' to get
it to work?

Andrew Poulos
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Andrew Poulos wrote:
I'm trying out the code from alistapart
<url:http://www.alistapart.com/articles/alternate/> to change the
current stylesheet


[snip]
The code on alistapart works fine. It was a scope issue at my end.

Andrew Poulos
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.