Forum Moderators: not2easy
I am writing an application that switches a <body>'s class out on an anchor's onclick. It works perfectly in FF, applying the correct styling as I planned it to.
The problem is IE; even though the <body>'s class appears to be correct, the stylesheet's styling doesn't seem to get applied "on the fly" so to speak. Do I need to do anything special to get IE to "re-apply" the stylesheet?
Thanks,
theenglishguy
I have a lot of alerts in place, and it appears to be applying the class. What isn't happening is the stylesheet applying its styling.
I.e., I start out with <body class="one"> which has this css:
.one #columns {
background-color: grey;
}
I change it to class="two" via javascript, which has this corresponding css:
.two #columns {
background-color: blue;
}
But it never gets applied.
<td style="background-color:gray">
I think the problem is that you'd need to refresh the page for the change to actually take place.
A better option yet is to use a styleswitcher. You can do that with php, or javascript.
Go to A List Apart and look for the article "Invasion of the Body Switchers" by Andy Clarke, James Edwards for a Javascript styleswitcher, or "Build a PHP Switcher"
by Chris Clark for a PHP one.