FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

[IE7] Stylesheet Selection Support

 


Stubru Freak
Nope. I think I tried all menu's of IE7 and it doesn't have stylesheet selection support. For those who don't know what I mean:
http://www.w3.org/Style/Examples/007/alternatives.html
How do they think they will ever be half as good as firefox if they don't implement functions like this that even Netscape implements already. Yet another reason to Kill Bill's Browser. But how will you explain that to your visitors?
So my point is, IE7 doesn't have stylesheet selection support. What it does have is the security hole to type insanely long javascripts in the url bar.
So this is a stylesheet selection script to bookmark that will work on all standard-complying pages:

Install: just make a new bookmark of any page (in IE7), right-click the bookmark, choose properties, and enter this code in the location field, press ok and press ok again when a security message pops up:
Code:
javascript:var ssLinks, ssEnum, ssList, ssTitle, ssStyle, ssOption;ssList = new Array();ssLinks = document.getElementsByTagName("link");for (ssEnum = new Enumerator(ssLinks); !ssEnum.atEnd(); ssEnum.moveNext()){if((ssEnum.item().getAttribute("rel") == "stylesheet" || ssEnum.item().getAttribute("rel") == "alternate stylesheet" || ssEnum.item().getAttribute("rel") == "alternative stylesheet") && (ssEnum.item().getAttribute("media") == null || ssEnum.item().getAttribute("media") == "" || ssEnum.item().getAttribute("media").indexOf("screen") != -1 || ssEnum.item().getAttribute("media").indexOf("all") != -1 ) && (ssEnum.item().getAttribute("title") != null && ssEnum.item().getAttribute("title") != "")){ssList[ssList.length] = ssEnum.item();if(ssEnum.item().getAttribute("rel") == "stylesheet"){ssActive = ssList.length - 1;}}}if(ssList.length == 0){alert("Switching stylesheets not possible here!");} else {function changeStyle(){var ssOption;ssOption = document.getElementById("ssSelect").value;document.body.innerHTML = ssOldHTML;ssList[ssActive].setAttribute("rel", "alternate stylesheet", 0);ssList[ssOption].setAttribute("rel", "stylesheet", 0);}ssForm = '<div id="ssDIV" style="position: absolute; left: 0; top: ' + document.documentElement.scrollTop + '; background-color: gray;">';ssForm += '<form onsubmit="return changeStyle();"><select id="ssSelect" onchange="changeStyle();">';for(ssOption in ssList){ssForm += '<option value="' + ssOption + '"';if(ssOption == ssActive){ssForm += 'selected="selected"';}ssForm += '>';ssForm += ssList[ssOption].getAttribute("title");ssForm += '</option>';}ssForm += '<input type="submit" value="OK" /></select></form></div>';ssOldHTML = document.body.innerHTML;document.body.innerHTML = document.body.innerHTML + ssForm;}void(0);// http://fvds.frih.net


Notes:

• Only known browser this code works in is IE7.
- It uses IE specific functions (which doesn't matter as all other browsers can change the stylesheet without my help)
- Versions of IE below v7 can't handle scripts as long as this in the location bar. They shouldn't. What they should do is implement a stylesheet changer.

• Once IE7 goes public, you should probably ask your visitors to add this link to their favorites instead of making your own style changing script.
They will certainly appreciate the extra functionality your website added to their browser.

I hope this was usefull. Very Happy It is to me anyway :p
Frederik Vanderstraeten
Related topics
Government takes over all student loans.
W00t! Something that finally fixes IE.
Opera 9.0 Technology Preview 2
I want to be xhtml compliant...
Faking fixed position in Internet Explorer
which is better firefox or IE7?
Sexual Selection
I Have a question . Is it the server support Chinese?
LINK SUPPORT??? PLZ HELP ITS CONFUSING
file support
Gigabyte to support four SLI graphics cards on one
What football team do u support?
Tech Support
If you Support asp that is well
2 good Customer Support jokes!!!
Does this host support email redirects
OS support
FOR WAR OR NOT
Please Support my Site - I need votes for the CNC Awards '05
(official) IE 7 Topic
Do we support php include and/or SSI?
Okay, I'm done trying to use CSS for layout.
Programming Help & Support Guidelines
Site Nav Suggestions...
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.