JavaScript Reference/Javascript Collections/rules
Содержание
"rules" Example
<html>
<head>
<style type="text/css" id="myStyle">
.rule1 { font-family:Times New Roman; font-size:18pt; color:blue; }
.rule2 { font-family:Verdana; color:red; }
.rule3 { color:red; }
</style></head>
<body>
<button onclick="alert(document.styleSheets(0).rules.length);">
Get number of rules
</button>
"rules" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |styleSheet |
+----------------+--------------------------------------------------------------+
"rules" JavaScript properties and JavaScript methods
JavaScript properties and JavaScript methods
item(), length
"rules" Syntax Parameters and Note
Note:
Returns an array of all style sheets that make use of the @rule rule.
Syntax:
document.styleSheets(index).rules // returns all rules
document.styleSheets(index).rules(param1) // returns an individual rule
Parameters:
param1 Required; the zero-based index