Home | All Questions | alt.html FAQ >

How do I read stylesheet information in Javascript?

You can read the style sheets:

Mozilla browsers (Netscape 6.0+)

 document.styleSheets[index].cssRules[index].style.backgroundColor

Internet Explorer 4

 document.styleSheets[index].rules[index].style.backgroundColor

Internet Explorer 5 and above

 element.currentStyle.backgroundColor

Netscape Navigator 4

 window.getComputedStyle(element, '').getPropertyValue('background-color')

Recommended Resources

Discussion

Related Questions