javascript document createStyleSheet( )
createStyleSheet( ) | Firefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM n/a |
createStyleSheet(["url"[, index]]) |
|
This method performs the same actions in IE for Windows and Macintosh, but their returned values differ. Moreover, the specific actions in the document tree depend upon the parameters passed with the method. When no parameters are included, the method inserts a blank style element into the document tree. This style element, however, is not reflected in the document.styleSheets collection until you add one or more style rules to the object. But if you specify a URL to an external .css file as the first parameter, the method creates and inserts a link element into the document's head section, bringing the external style rules to life immediately. |
|
IE for Windows always returns a reference to a styleSheet object; IE for Macintosh returns a reference to the newly inserted element, which will be a style or link element, depending on the parameter makeup. The inserted style element reference is of little help for adding a rule because you can't reference the styleSheet object. For cross-operating-system compatibility, it's best to use this method only for external style sheets. |
|
Parameters | |
|
|
Returned Value | |
styleSheet object reference (Windows); style or link element object reference (IE 5 and later for Macintosh). |
Powered by Linode.