PDA

View Full Version : Is there an equivalant of element.sheet in IE6?


Jero
04-14-2007, 01:21 AM
When I use document.getElementsByTagName('style')[0].sheet in Firefox or Opera, it returns the CSSStyleSheet object. However, IE6 returns nothing. So I was wondering if there's a property in IE that works the same as the .sheet property.

var stylesheet = document.getElementsByTagName('style')[0].sheet;
alert(stylesheet.cssRules.length); // 34

COBOLdinosaur
04-14-2007, 07:40 PM
document.stylesheets[0]

Should work in all browsers