Availability: |
| |||
JavaScript syntax: | IE | myStyleSheet.addRule(aSelector, aStyle) | ||
IE | myStyleSheet.addRule(aSelector, aStyle, anIndex) | |||
Argument list: | anIndex | A index in the collection where the new rule should be inserted | ||
aSelector | The style rule selector string | |||
aStyle | A series of style settings for this rule |
This method allows individual rules to be added to a style sheet. You may want to control the precedence of the rules, and so the optional index value can be used to determine where in the collection of rules the new rule is to be inserted.
If the index is omitted, the new rule is simply appended to the style sheet.
You can override rules as long as you are not changing the type of rule being defined. Positional rules must always be overridden by a new positioning rule and cannot be changed to an appearance rule and vice versa.
Prev | Home | Next |
StyleSheet.addImport() | Up | StyleSheet.cssRules[] |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |