The Imports Collection

The Imports collection is Internet Explorer 4.0 specific.

The Imports collection is a collection of all the imported style sheets, defined for the StyleSheet Object. (An imported style sheet is one that has been included in the document using the @import Style Sheet attribute in a <STYLE>. Note that the imports collection can only be accessed through the StyleSheet Object.

<STYLE TYPE="text/css" ID="CSS1">
@import: url (http://www.mysite.com/Style Sheets/newstyle.css)
@import: url (http://www.mysite.com/Style Sheets/bigred.css)
@import: url (http://www.mysite.com/Style Sheets/bigblue.css)
@import: url (http://www.mysite..com/Style Sheets/crazy.css)
H1 {font-size : 24pt; color : red}
</STYLE>

Referencing:

document.StyleSheets(0).imports(2).href

would return http://www.mysite.com/Style Sheets/bigblue.css - the location of the third imported stylesheet for the document. (Note the use of the StyleSheets collection to interrogate the imports collection.

Properties

length
The length property returns the number of elements in the collection. Note that the length count starts at 1, not 0 as the imports collection index does.

Methods

item
The item method retrieves single items, or sub-collections from the all collection. It accepts the following arguments:

all.item(index)

For the imports collection, the index argument can only be a number, representing the index of the imported stylesheet of interest.