View Full Version : Resolved Are style elements counted in document.styleSheets array?

07-16-2011, 06:35 PM
I have one question about <style> elements, are they counted in document.styleSheets array? and can I add rules to them by using insertRule() and deleteRule() methods? :confused:

07-16-2011, 08:14 PM
Generally speaking ... yes

But: As always IE is cooking for a different party ... the methods are called addRule and removeRule there.

Normal browsers

var myrules = document.styleSheets[0].cssRules; // all the rules
var myStyle = document.styleSheets[1];


var myrules = document.styleSheets[0].rules; // all the rules
var myStyle = document.styleSheets[1];

07-17-2011, 01:18 PM
Thanks, I knew that IE use addRule() and removeRule(), but I am working on a script that works on FireFox, so I don't have to target IE.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum