I am trying to make a javascript function that can rewrite javascript
rules dynamically (no, not the style tag of an individual element, but
the actual rule in the <head> portion of the document).
I have this code working in Mozilla (so I imagine Netscape browsers)
but it gives me an error with IE. A few questions about it:
First, here is my current code:
<code>
function expand(show)
{
for(var i=1;i<=linkNum;i++)
{
if(show == i)) document.styleSheets[0].cssRules[i].style.visibility="visible";
else document.styleSheets[0].cssRules[i].style.visibility="hidden";
}
}
</code>
As I said, this works in Moz, but not in IE. How do i handle this??
And my next question, instead of having to access each rule by its
index in an array of the stylesheet, is there a way I can access it by
name (so instead of doing cssRules[0], i could do.Rule("body") or
something with a similar function?)
I am trying to do some work with more advanced DHTML and am running
into even more IE specfic code it seems. Thanks for the help.