styleSheets collection

Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.

Members

The styleSheets collection has these types of members:

Methods

The styleSheets collection has these methods.

MethodDescription
item

Retrieves an object from a collection.

urns

Retrieves a collection of all objects to which a specified behavior is attached.

 

Properties

The styleSheets collection has these properties.

PropertyDescription

length

Sets or retrieves the number of objects in a collection.

 

Remarks

Style sheets that are imported using the @import rule and are contained within the style object are available through the imports collection.

Examples

This example shows how to display the number of style sheets in the document and how to display the title of the second style sheet in the document.



// Display the number of style sheets in the document
function stylesheetNum() {
   alert("There are " + document.styleSheets.length + " style sheets.");
}
// Display the title of the second style sheet in the document
function secondTitle() {
   alert("The title is: " + document.styleSheets[1].title);
}

 

 

Show:
© 2014 Microsoft