javascript cssRule style

style NN 6 IE 5 DOM 2  

 

Read/Write  

Returns a style object with properties that reflect the attribute settings of the current rule. This is the same kind of style object associated with elements in the document (corresponding to the W3C DOM CSSStyleDeclaration object). If you must modify style sheet settings at the rule level, do so via the style property of the rule or cssRule. Changes register themselves immediately, and the elements affected by the rule render their changes accordingly.

 
Example
 
var oneRule;
if (document.styleSheets) {
if (document.styleSheets[0].cssRules) {
oneRule = document.styleSheets[2].cssRules[1];
} else if (document.styleSheets[0].rules) {
oneRule = document.styleSheets[2].rules[1];
}
}
if (oneRule) {
oneRule.style.color = "red";
oneRule.style.fontWeight = "bold";
}
 
Value

Reference to a style (W3C CSSStyleDeclaration) object.

 
Default

Current style object.

 
W3C DOM CSSRule Types
 
CSSFontRule
CSSPageRule
CSSStyleRule

432,Nickname,Homepage or email,Comments here,Add comment