Javascript Reference
Categories: styleSheet

javascript styleSheet insertRule( )

@March 15, 2008, 1:22 a.m.
insertRule( )Firefox/Netscape/NN 6 IE 5(Mac) Chrome/Safari/DOM 2  

insertRule("ruleText", index)

  

Adds a new rule for a style sheet. This method offers a scripted way of adding a rule to an existing W3C DOM styleSheet object:

document.styleSheets[1].insertRule("p b {color:red}", 0);
 

You may duplicate a selector that already exists in the styleSheet and, therefore, override an existing rule for the same element selector. The only prohibition is that you may not override a rule to convert a plain style rule into one that creates a positionable element (or vice versa). The new rule is governed by the same cascading rules as all style sheet rules (that includes the rule's source code position among other rules with the same selector). Therefore, a new rule in a styleSheet object does not supersede a style set in an element's style property. Note that IE 5 for the Macintosh implements both the W3C DOM insertRule( ) and Microsoft addRule( ) methods to accomplish the same result.

 
Parameters
 
  • The entire style rule selector as a string in exactly the same format as assigned in a style element: selector {attribute:value; attribute:value;...}.
  • Zero-based integer indicating where in the cssRules collection the new rule should be placed.
 
Returned Value

Integer of the index location of the new rule.

The institute aims to bring the reactor up to its maximum capacity over the next six months <a href=https://enhanceyourlife.mom/>priligy and viagra</a>
Cleriebip - 1 months
generic lipitor <a href="https://lipiws.top/">lipitor 20mg for sale</a> lipitor 20mg pill
Wcuefm - 9 months
Under moderation.
CraigMek - 2018-01-25

Powered by Linode.