XML DOM deleteRule() method
Definition and usage
The deleteRule() method removes a rule from the stylesheet.
Syntax:
deleteRule(index)
Parameter | Description |
---|---|
index | Required. The index of the rule to be deleted in the cssRules array. |
Throw
This method will throw a DOMException with the following code under the following conditions DOMException exception:
- INDEX_SIZE_ERR
- index Does not correspond to any rule in the rule set of the stylesheet, such as index Is a negative number or a value greater than cssRules.length.
- NO_MODIFICATION_ALLOWED_ERR
- This stylesheet is read-only.
Description
This method will remove the cssRules array specified index The rule at the location, it is a DOM standard method. See CSSStyleSheet.addRule(), it is an alternative method specific to IE.
Example
Delete the first rule of the myStyles object:
myStyles.deleteRule(0);
Related pages
XML DOM reference manual:CSSStyleSheet.removeRule()