OZONE Asylum
Forums
DHTML/Javascript
Style switching doesn't work in IE
This page's ID:
27819
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
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; } } }[/code] You can see its implementation at http://robert-adam.com/proofs/djhomehealth/ Edit: Missing words. [small](Edited by [url=http://www.ozoneasylum.com/user/2340]SPyX[/url] on 04-21-2006 19:37)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »