Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


styleSheet Object

Represents a single style sheet in the document.

Members Table

The following table lists the members exposed by the styleSheet object. Click a tab on the left to choose the type of member you want to view.

Attributes/Properties  
 
Attributes/Properties
Collections
Methods
Objects
Styles
Attribute Property Description
canHaveHTML Sets or retrieves the value indicating whether the object can contain rich HTML markup.
disabled Sets or retrieves whether a style sheet is applied to the object .
href Sets or retrieves the URL of the linked style sheet.
ID id Retrieves the string identifying the object .
isContentEditable Retrieves the value indicating whether the user can edit the contents of the object .
isDisabled Retrieves the value indicating whether the user can interact with the object .
isMultiLine Retrieves the value indicating whether the content of the object contains one or more lines.
owningElement Retrieves the next object in the HTML hierarchy.
parentStyleSheet Retrieves the style sheet that imported the current style sheets.
readOnly Retrieves whether the rule or style sheet is defined on the page or is imported.
TITLE title Sets or retrieves the title of the style sheet.
type Retrieves the Cascading Style Sheets (CSS) language in which the style sheet is written.

Remarks

You can use this object to retrieve style sheet information, such as the URL of the source file for the style sheet and the element in the document that owns (defines) the style sheet. You also can use it to modify style sheets.

You can retrieve a styleSheet object from the styleSheets collection or from the imports collection. Each item in these collections is a style sheet. A styleSheet object is available for a style sheet only if it is included in a document with a style or link element, or with an @import statement in a style element.

This object is available in script as of Microsoft® Internet Explorer 4.0.

Example

This example uses the styleSheet object to change the cascading style sheets (CSS) values of inline and imported styles.

 

<STYLE>
BODY {background-color: #CFCFCF;}
@import url("otherStyleSheet.css");
</STYLE>
<SCRIPT>
window.onload=fnInit;
function fnInit(){
// Access a rule in the styleSheet , change backgroundColor to blue.
var oStyleSheet=document.styleSheets[0];
var oRule=oStyleSheet.rules[0];
oRule.style.backgroundColor="#0000FF";
// Add a rule for P elements to have yellow backgrounds.
oStyleSheet.addRule("P","background-color: #FFFF00;");
// Change and imported rule:
oStyleSheet.imports[0].color="#000000"; }
</SCRIPT>

Standards Information

There is no public standard that applies to this object.

Applies To

Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
 
styleSheets

 

Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.