hi
Does anyone how how to access css properties from javascript, can it be done?
thanksYou can use the various style (<!-- m --><a class="postlink" href="http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/style.html">http://devedge.netscape.com/library/man ... style.html</a><!-- m -->) objects.
AdamOriginally posted by AdamGundry
You can use the various style (<!-- m --><a class="postlink" href="http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/style.html">http://devedge.netscape.com/library/man ... style.html</a><!-- m -->) objects.I think those only ever worked in Netscape 4.x. In any case, you can access CSS rule values via the inline style property, or get computed styles using DOM2 CSS.thx very much
They seem to work in ie6 toriginally posted by lincsimp
They seem to work in ie6 too.That couldn't possibly be true. All of those properties are specific to Netscape 4.x. Meaning they only ever worked in Netscape 4.x was out and further, when Gecko (Mozilla) was released (Netscape 6.0+) they were dropped. They couldn't possibly have ever worked in IE.
I've done typeof checks on all properties, and under Mozilla 1.7/Firefox 0.9 they all return, as expected, undefined. To access inline styles as I said before, use the style property:<div id="foo" style="color: red;">Hello, World!</div>var fooColor = document.getElementById('foo').style.color; // "red"Or, to grab computed or otherwise non-inline styles:<div>Hello, World!</div>var fooDisplay = document.defaultView.getComputedStyle(document.getElementById('foo'), null).getPropertyValue('display'); // "block"Sorry, I should have been clearer. I was referring to the style property Fred mentioned, which returns a style object containing the properties listed on Netscape's site. Just ignore the "Created By" section of the NS docs.
I guess I should have given an example.
Adam
Does anyone how how to access css properties from javascript, can it be done?
thanksYou can use the various style (<!-- m --><a class="postlink" href="http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/style.html">http://devedge.netscape.com/library/man ... style.html</a><!-- m -->) objects.
AdamOriginally posted by AdamGundry
You can use the various style (<!-- m --><a class="postlink" href="http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/style.html">http://devedge.netscape.com/library/man ... style.html</a><!-- m -->) objects.I think those only ever worked in Netscape 4.x. In any case, you can access CSS rule values via the inline style property, or get computed styles using DOM2 CSS.thx very much
They seem to work in ie6 toriginally posted by lincsimp
They seem to work in ie6 too.That couldn't possibly be true. All of those properties are specific to Netscape 4.x. Meaning they only ever worked in Netscape 4.x was out and further, when Gecko (Mozilla) was released (Netscape 6.0+) they were dropped. They couldn't possibly have ever worked in IE.
I've done typeof checks on all properties, and under Mozilla 1.7/Firefox 0.9 they all return, as expected, undefined. To access inline styles as I said before, use the style property:<div id="foo" style="color: red;">Hello, World!</div>var fooColor = document.getElementById('foo').style.color; // "red"Or, to grab computed or otherwise non-inline styles:<div>Hello, World!</div>var fooDisplay = document.defaultView.getComputedStyle(document.getElementById('foo'), null).getPropertyValue('display'); // "block"Sorry, I should have been clearer. I was referring to the style property Fred mentioned, which returns a style object containing the properties listed on Netscape's site. Just ignore the "Created By" section of the NS docs.
I guess I should have given an example.
Adam