Style Sheet Switcher - IE Problem

Tuesday 26th May, 2009

I've just been implementing my first ever stylesheet switching script on a project I'm working on at the moment - unsure as to the best way to achieve this, a quick google search led me to A List Apart and Paul Sowden's great little javascript which does the trick nicely.

http://www.alistapart.com/articles/alternate/

All was well and good until I tested in Internet Explorer (shock!). Instead of switching the stylesheet it would simply switch off the current styles.

Eventually I managed to trace the problem back to the fact I was using a single link to switch between the styles and to do this I had niavely used a variable called 'currentStyle' to store the name of the current stylesheet which would then be used in the switcher link.

As it turns out IE uses the term currentStyle as a proprietary way of calling the style settings of an object. What are the chances eh?

Comments

Please login to comment on this page

back