Availability: |
| |||
Property/method value type: | styleSheet object | |||
JavaScript syntax: | IE | myDocument.createStyleSheet() | ||
IE | myDocument.createStyleSheet(aURL) | |||
IE | myDocument.createStyleSheet(aURL, anIndex) | |||
Argument list: | aURL | The URL to load the style sheet from | ||
anIndex | A location within the stylesheet list to insert this stylesheet |
This is a means of adding a style sheet to a document from the JavaScript context.
When you create the style sheet, you have the choice of simply creating an empty styleSheet object or calling one in from a URL document source location.
You can also specify where in the hierarchy of currently loaded style sheets this new one should be placed by specifying its index location within the styleSheets collection.
If you can locate this styleSheet object once it has been installed, you can carry out further modifications on it by means of the addRule() method. This may be somewhat problematic on some browser versions and platforms since you don't get an object reference handle back from this method. You might be able to code around that, however, since you can specify a target index position in the styleSheets collection. That may mean you can get a reference to it indirectly once it has been added.
Although this method is supposed to return a styleSheet object, on the Macintosh platform it returns a null value in some versions of the MSIE browser.
See also: | Document object, StyleSheet object, StyleSheet.addRule() |
Prev | Home | Next |
Document.createProcessingInstruction() | Up | Document.createTextNode() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |