Home | Top | Web development | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Retrieves a collection of rules defined in a style sheet.
Syntax
[ oColl = ] styleSheet.rules |
[ oObject = ] styleSheet.rules( iIndex ) |
Possible Values
oColl | Array of rules. |
oObject | Reference to an individual item in the array of elements contained by the object. |
iIndex | Required. Integer that specifies the zero-based index of the item to be returned. |
Remarks
This collection is always accessible, even if the style sheet is not enabled. Rules are added to the rules collection with the addRule method on the individual style sheet. A rule that is added to a disabled style sheet does not apply to the document unless the style sheet is enabled. Rules are deleted with the removeRule method.
The rules in this collection are in the source order of the document. As rules are added or deleted through the Cascading Style Sheets (CSS) Object Model, a rule's absolute position in the rules collection might change, but its position relative to other rules remains the same. When you add rules without specifying an index, the rule gets added to the document last. If you specify an index, however, the rule is inserted before the rule currently in that ordinal position in the collection. If the specified index is greater than the number of rules in the collection, the rule is added to the end.
Example
This example shows how to use the rules collection to identify the color specified in style sheet rules.
<HTML>
Standards Information
This collection is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To
|
styleSheet |
Home | Top | Web development | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |