JavaScript Reference/Javascript Collections/styleSheets — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
Содержание
"styleSheets" Example
<html>
<head>
<style type="text/css">
.rule1 { font-family:Times New Roman; font-size:18pt; color:blue; }
</style>
<style type="text/css">
.rule2 { font-family:Verdana; color:red; }
</style>
</head>
<body>
<button onclick="function1();">Get total style sheets in this document.</button>
<script language="JavaScript">
function function1() {
var m = document.styleSheets.length;
alert(m);
}
</script>
</body>
</html>
"styleSheets" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |document |
+----------------+--------------------------------------------------------------+
"styleSheets" JavaScript properties and JavaScript methods
JavaScript properties and JavaScript methods
item(), length, namedItem(), urns()
"styleSheets" Syntax Parameters and Note
Note:
Returns an array of all the style sheets in the <link> and <style> elements.
Syntax:
document.styleSheets // returns all style sheets
document.styleSheets(param1, param2) // returns an individual style sheet
Parameters:
param1 Required; zero-based index or
the desired member"s id or name attribute.
param2 Optional; the zero-based index for the result returned
if param1 matches more than one element.