06.28.06
finally usable Opera!
Of course, I don’t mean to sound like Opera-hater, but as I’ve been learning how to manipulate CSS via JavaScript recently, I was shocked to find out that even quite recent Opera 8.5x doesn’t provide way to access CSS with standard, W3C’s DOM way (or even dumb, not standard-compliant way that IE uses). But, fortunately, this was fixed in Opera 9. I don’t know if I’m a technocrat or something, but with browsers and W3C standards, I find myself wandering “how the heck we could live without this new feature?” too often.
And BTW, here’s the code I used to show something hidden by CSS.
if (navigator.appName == "Microsoft Internet Explorer") {
//for dumbest browser ever, Internet Explorer
for (var x = 0; x < document.styleSheets[0].rules.length; x++) {
if (document.styleSheets[0].rules[x].selectorText==".classWeWantToShow") var n = x;
}
document.styleSheets[0].rules[n].style.display = "block";
} else {
//proper, standard-compliant way to do it:
for (var x = 0; x < document.styleSheets[0].cssRules.length; x++) {
if (document.styleSheets[0].cssRules[x].selectorText==".classWeWantToShow") var n = x;
}
document.styleSheets[0].cssRules[n].style.display = "block";
}
document.getElementById(’somethingWeWantToHide’).style.display = "none";
}