JavaScript Reference/Javascript Collections/imports

Материал из Web эксперт
Перейти к: навигация, поиск

"imports" Example

    
<html>
<head>
<style type="text/css" id="myStyle">
@import "external.css";
@import "examples.css";
@import "heading.css";
@import "page.css";
@import "site.css";
@import "application.css";
</style></head>
<body>
<p>Body content.</p>
<script language="JavaScript">
    alert(document.styleSheets(0).imports.length);
</script>
</body>
</html>



"imports" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |styleSheet                                                    |
+----------------+--------------------------------------------------------------+



"imports" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem()



"imports" Syntax Parameters and Note

Note:
Returns an array of all style sheets that have been linked to the page using 
the @import rule.
    
Syntax:
    
document.styleSheets(index).imports // returns all style sheets
document.styleSheets(index).imports(param1) // returns an individual style sheet

    param1   Required; the zero-based index