importsNN n/a IE 4 DOM n/a  

  

A collection (array) of styleSheet objects imported into an explicit styleSheet object via the @import rule. In other words, a styleSheet object that employs an @import treats that imported style sheet as a nested object, but one that is, itself, a full-fledged styleSheet object. Thus, you can access the rule objects within each imported style sheet. The following example iterates through all of the document's styleSheet objects in search of imported style sheets:

for (var i = 0; i< document.styleSheets.length; i++) {
    for (var j = 0; j < document.styleSheets[i].imports.length; j++) {
        // process each imported style sheet, referenced
        // here as document.styleSheets[i].imports[j]
    }
} 
 
Object Model Reference
 
document.styleSheets[i].imports
 
Object-Specific Properties

length

 
Object-Specific Methods

item( )

lengthNN n/a IE 4 DOM n/a  

Read-only  

Returns the number of objects in the collection.

 
Example
 
var howMany = document.styleSheets[i].imports.length;
 
Value

Integer.

item( )NN n/a IE 4 DOM n/a  

item(index)

  

Returns a single imported styleSheet object corresponding to the index value in source code order of @import rules. IE 5 for Macintosh erroneously returns null.

 
Parameters
 
index

A zero-based integer.

 
Returned Value

Reference to an imported styleSheet object. If there are no matches to the parameters, the returned value is null.