| Package | dom.style.stylesheets |
| Class | public class StyleSheet |
| Inheritance | StyleSheet Object |
| Subclasses | CSSStyleSheet |
| Introduced in: | DOM 2 Core |
All browser compatibility information was obtained via Quirksmode.
See also
| Property | Defined By | ||
|---|---|---|---|
| DOM 2 Style disabled : Boolean [read-only]
This property indicates whether the current stylesheet is applied or not. | StyleSheet | ||
| DOM 2 Style href : DOMString [read-only]
If the style sheet is a linked style sheet, the value of its attribute is its location. | StyleSheet | ||
| DOM 2 Style media : DOMString
Specifies the intended destination medium for style information. | StyleSheet | ||
| DOM 2 Style ownerNode : Node [read-only]
The node that associates this style sheet with the document. | StyleSheet | ||
| DOM 2 Style parentStyleSheet : StyleSheet [read-only]
For style sheet languages that support the concept of style sheet inclusion, this attribute represents
the including style sheet, if one exists. | StyleSheet | ||
| DOM 2 Style title : DOMString [read-only]
The advisory title. | StyleSheet | ||
| DOM 2 Style type : DOMString [read-only]
This specifies the style sheet language for this style sheet. | StyleSheet | ||
| DOM 2 Style disabled | property |
disabled:Boolean [read-only] | Product Versions : |
| Introduced in: | DOM 2 Core |
This property indicates whether the current stylesheet is applied or not.
public function get disabled():BooleanSee also
// if the stylesheet is disabled...
if (stylesheet.disabled) {
// apply style in-line
}| DOM 2 Style href | property |
href:DOMString [read-only] | Product Versions : |
| Introduced in: | DOM 2 Core |
If the style sheet is a linked style sheet, the value of its attribute is its location. For inline style sheets, the value of this attribute is null.
public function get href():DOMStringSee also
// on a local machine:
<html>
<head>
<link rel="StyleSheet" href="example.css" type="text/css" />
<script>
function sref() {
alert(document.styleSheets[0].href);
}
</script>
</head>
<body>
<div class="thunder">Thunder</div>
<button onclick="sref()">ss</button>
</body>
</html>
// returns "file:////C:/Windows/Desktop/example.css| DOM 2 Style media | property |
media:DOMString| Introduced in: | DOM 1 Core |
Specifies the intended destination medium for style information. DOM 1 Spec
A string describing a single medium or a comma-separated list.
DOM Level 2 Style SpecThe intended destination media for style information. The media is often specified in the ownerNode. If no media has been specified, the MediaList will be empty.
Note: According to DOM Level 2 Style specification, the Media property is supposed to be Read-Only and return an instance of the MediaList object. Most browsers handle this property as it was specified in DOM Level 1.
Note: Acceptable values are as listed:
The default value is "screen" for Firefox and "all" for Internet Explorer.
public function get media():DOMString public function set media(value:DOMString):voidSee also
| DOM 2 Style ownerNode | property |
ownerNode:Node [read-only] | Product Versions : |
| Introduced in: | DOM 2 Core |
The node that associates this style sheet with the document. For HTML, this may be the corresponding LINK or STYLE element. For XML, it may be the linking processing instruction. For style sheets that are included by other style sheets, the value of this attribute is null.
public function get ownerNode():NodeSee also
<html>
<head>
<link rel="StyleSheet" href="example.css" type="text/css" />
<script>
function stilo() {
alert(document.styleSheets[0].ownerNode);
}
</script>
</head>
<body>
<div class="thunder">Thunder</div>
<button onclick="sref()">ss</button>
</body>
// displays "object HTMLLinkElement"
</html>| DOM 2 Style parentStyleSheet | property |
parentStyleSheet:StyleSheet [read-only] | Product Versions : |
| Introduced in: | DOM 2 Core |
For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of this attribute is null.
public function get parentStyleSheet():StyleSheetSee also
// find the top level stylesheet
if (stylesheet.parentStyleSheet) {
sheet = stylesheet.parentStyleSheet;
} else {
sheet = stylesheet;
}| DOM 2 Style title | property |
title:DOMString [read-only] | Introduced in: | DOM 2 Core |
The advisory title.
Note: The title is often specified in the ownerNode.
public function get title():DOMStringSee also
| DOM 2 Style type | property |
type:DOMString [read-only] | Introduced in: | DOM 2 Core |
This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type. The content type is often specified in the ownerNode.
public function get type():DOMStringSee also
ss.type = "text/css";