| Availability: |
| ||||||
| JavaScript syntax: | IE | myRule = myDocument.all.aStyleSheetID.rules[anIndex] | |||||
| IE | myRule = myStyleSheet.rules[anIndex] | ||||||
| IE | myRule = mySelectorArray[anIndex] | ||||||
| - | myRule = myDocument.styleSheets[anIndex].cssRules[anIndex] | ||||||
| Argument list: | anIndex | A reference to an element in a collection | |||||
| Object properties: | cssText, parentStyleSheet, readOnly, runtimeStyle, selectorText, style | ||||||
This is referred to as a selector and one or more declarations within a cascading style sheet (CSS). It is supported by MSIE.
DOM level 2 calls this a CSSRule object. It also describes a CSSStyleRule object as a sub-class of that object. The MSIE browser implements both as a single class. The CSSRule class maintains the following named constants:
| Value | Name | DOM |
|---|---|---|
| 0 | UNKNOWN_RULE | 2 |
| 1 | STYLE_RULE | 2 |
| 2 | CHARSET_RULE | 2 |
| 3 | IMPORT_RULE | 2 |
| 4 | MEDIA_RULE | 2 |
| 5 | FONT_FACE_RULE | 2 |
| 6 | PAGE_RULE | 2 |
DOM level 2 specifies these additional properties:
type
parentRule
| Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
|---|---|---|---|---|---|---|---|---|---|---|---|
| cssText | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 2 ![]() | ![]() | ![]() | - |
| parentStyleSheet | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 2 ![]() | ![]() | ![]() | - |
| readOnly | ![]() | 3.0 ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ReadOnly. |
| runtimeStyle | ![]() | 5.0 ![]() | ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
| selectorText | 1.5 ![]() | 3.0![]() | 6.0 ![]() | 4.0![]() | ![]() | ![]() | ![]() | 2 ![]() | ![]() | ![]() | ReadOnly. |
| style | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 2 ![]() | ![]() | ![]() | - |
| Prev | Home | Next |
| RUBY object | Up | rule.cssText |
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. | ||