Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

insertRule method

Inserts a new rule into the style sheet.

Document Object Model (DOM) Level 2 Style Specification, Section 2.2Internet Explorer 9


var retval = styleSheet.insertRule(bstrRule, lIndex);


bstrRule [in]

Type: String

The text that represents the rule, which must be able to be parsed. For rule sets, this specifies both the selector and the style declaration. For at-rules, this specifies both the at-identifier ("@rule_name") and the rule content.

lIndex [in]

Type: Integer

The index within the style sheet's rule list of the rule before which to insert the specified rule. If the specified index equals the length of the style sheet's rule list, the rule will be added to the end of the style sheet.

Return value

Type: Integer

The newly inserted rule's index within the style sheet's rule list.

Standards information


After the new rule has been inserted, it becomes part of the cascade.

See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.