Chapter 13 DOM CSS

Counter

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS object.

Description

Table 13.1 Arguments Associated With Counter Object

Image

Example

Listing 13.1 illustrates reading the properties of the Counter object.

Listing 13.1 Reading Properties of the Counter Object

<html>
<script language="JScript">
<!--
var counterObj = primitiveValObj.getCounterValue();
var idVal = counterObj.identifier;
var listStyleVal = counterObj.listStyle;
var separatorVal = counterObj.separator;
// -->
</script>
</html>

Counter.identifier

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

CounterObj.identifier

Description

The read-only property identifier of the Counter object is used for to identify the counter.

Example

Listing 13.2 illustrates reading the identifier property of the Counter object.

Listing 13.2 Reading the identifier property of the Counter Object

<html>
<script language="JScript">
<!--
var counterObj = primitiveValObj.getCounterValue();
var idVal = counterObj.identifier;
var listStyleVal = counterObj.listStyle;
var separatorVal = counterObj.separator;
// -->
</script>
</html>

Counter.listStyle

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

counterObj.listStyle

Description

The read-only property listStyle of the Counter object is of type String. The listStyle property is used for the style of the list.

Example

Listing 13.3 illustrates reading the listStyle property of the Counter object.

Listing 13.3 Reading Properties of the Counter Object

<html>
<script language="JScript">
<!--
var counterObj = primitiveValObj.getCounterValue();
var idVal = counterObj.identifier;
var listStyleVal = counterObj.listStyle;
var separatorVal = counterObj.separator;
// -->
</script>
</html>

Counter.separator

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

Counter.separator

Description

The read-only property separator of the Counter object is of type String. The separator property is used for the separator of the nested counters.

Example

Listing 13.4 illustrates reading the separator property of the Counter object.

Listing 13.4 Reading Properties of the Counter Object

<html>
<script language="JScript">
<!--
var counterObj = primitiveValObj.getCounterValue();
var idVal = counterObj.identifier;
var listStyleVal = counterObj.listStyle;
var separatorseparatorVal = rectObj.separator;
// -->
</script>
</html>

CSSCharsetRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSCharsetRule object represents a @charset rule in a CSSStyleSheet. CSSCharsetRule extends CSSRule. The property associated with the CSSCharsetRule object is as follows:

Item

Description

encoding

This is a read-only property of type String. Represents a list of media types for this rule.

Example

Listing 13.5 demonstrates reading the encoding property of the CSSCharsetRule object.

Listing 13.5 Reading the encoding Property

<html>
<script language="JScript">
<!--
document.writewrite(cssCharsetRuleObj);
// -->
</script>
</html>

CSSCharsetRule.encoding

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssCharsetRuleObj.encoding

Description

The read-only property encoding of the CSSCharsetRule object is of type String. Encoding contains the encoding information used in this rule. This attribute can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and SYNTAX_ERR.

Example

Listing 13.6 demonstrates reading the encoding property of the CSSCharsetRule object.

Listing 13.6 Reading the encoding Property

<html>
<script language="JScript">
<!--
document.write(cssCharsetRuleObj.encoding);
// -->
</script>
</html>

CSSFontFaceRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSFontFaceRule object represents a set of font descriptions in a CSSStyleSheet. CSSFontFaceRule inherits all properties and methods from CSSRule. The property associated with the CSSFontFaceRule object is as follows:

Item

Description

style

This is a read-only property of type CSSStyleDeclaration. Represents declaration block of the rule.

Example

Listing 13.7 demonstrates manipulating the style property of the CSSFontFaceRule object.

Listing 13.7 Manipulating the style Property

<html>
<script language="JScript">
<!--
cssFontFaceRuleObj.style.face = "courier";
// -->
</script>
</html>

CSSFontFaceRule.style

JavaScript 1.5+, JScript 5+

Nav6+, IE5+JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssFontFaceRuleObj.style

Description

This read-only attribute is of type CSSStyleDeclaration. This attribute represents the declaration block of the rule.

Example

Listing 13.8 demonstrates manipulating the style property of the CSSFontFaceRule object.

Listing 13.8 Manipulating the style Property

<html>
<script language="JScript">
<!--
cssFontFaceRuleObj.style.face = "ariel";
// -->
</script>
</html>

CSSImportRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSImportRule object represents the @import rule of a CSSStyleSheet. CSSImportRule inherits all methods and properties of CSSRules. Table 13.2 lists all properties of the CSSImportRule object.

Table 13.2 Properties Associated with the CSSImportRule Object

Image

Example

Listing 13.9 demonstrates reading the href property of the CSSImportRule object.

Listing 13.9 Reading the href Property

<html>
<script language="JScript">
<!--
document.writewrite(cssImportRuleObj.href);
// -->
</script>
</html>

CSSImportRule.href

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssImportRuleObj.href

Description

The read-only property href of the CSSImportRule object is of type string. The href property is the textual representation of the location of the style sheet to be imported. The URI specifier won’t be included in this attribute.

Example

Listing 13.10 demonstrates reading the href property of the CSSImportRule object.

Listing 13.10 Reading the href Property

<html>
<script language="JScript">
<!--
document.write(cssImportRuleObj.href);
// -->
</script>
</html>

CSSImportRule.media

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssImportRuleObj.media

Description

The read-only property media of the CSSImportRule object is of type MediaList. The media property is a list of media types that can be used by the style sheet.

Example

Listing 13.11 demonstrates reading the media property of the CSSImportRule object.

Listing 13.11 Reading the media Property

<html>
<script language="JScript">
<!--
document.write(cssImportRuleObj.media);
// -->
</script>
</html>

CSSImportRule.styleSheet

JavaScript 1.5+, JScript 5+

Nav6+, IE5+JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssImportRuleObj.styleSheet

Description

The read-only property styleSheet of the CSSImportRule object is of type CSSStyleSheet. The styleSheet property represents the loaded style sheet of this rule. If a style sheet hasn’t been loaded by this rule, the value will be Null.

Example

Listing 13.12 demonstrates reading the styleSheet property of the CSSImportRule object.

Listing 13.12 Reading the styleSheet Property

<html>
<script language="JScript">
<!--
document.write(cssImportRuleObj.styleSheet);
// -->
</script>
</html>

CSSMediaRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSMediaRule object represents the target media types of a set of rules. CSSMediaRule extends CSSRule. Table 13.3 lists all methods and properties of the CSSMediaRule object.

Table 13.3 Arguments Associated with the CSSMediaRule Object

Image

Example

Listing 13.13 gets a CSSMediaRule and sets its media type.

Listing 13.13 Setting a Media Type

<html>
<script language="JScript">
<!--
mediaRuleObj.media = "screen";
// -->
</script>
</html>

CSSMediaRule.cssRules

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssMediaRuleObj.cssRules

Description

The cssRule property of the CSSMediaRule object is a read-only attribute of type CSSRuleList. This is a list of CSS rules contained within the media block.

Example

Listing 13.14 demonstrates iterating through the cssRules property and processing each item.

Listing 13.14 Iterating Through cssRules

<html>
<script language="JScript">
<!--
var ruleList = cssMediaRuleObj.cssRules;
var i = 0;
while( i < ruleList.length) {
       processRule(ruleList.item(i);
       i++;
}
// -->
</script>
</html>

CSSMediaRule.deleteRule()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssMediaRuleObj.deleteRule(index)

Description

The deleteRule() method of the CSSMediaRule takes the argument Number index. This method deletes the rule from the media block. This method can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and SYNTAX_ERR.

Example

Listing 13.15 demonstrates removing a CSS media rule from the media block.

Listing 13.15 Removing a CSS Media Rule Using the deleteRule() Method

<html>
<script language="JScript">
<!--
cssMediaRule.deleteRule(1);
// -->
</script>
</html>

CSSMediaRule.insertRule()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssmediaRuleObj.insertRule(rule, index)

Description

The insertRule() method of the CSSMediaRule object takes the arguments String rule and Number index and returns the index of the newly inserted rule. This method can raise a DOMException with the values of HIERARCHY_REQUEST_ERR, INDEX_SIZE_ERR, NO_MODIFICATION_ALLOWED_ERR, and SYNTAX_ERR.

Example

Listing 13.16 illustrates inserting a rule into the media block.

Listing 13.16 Inserting a Rule into the Media Block Using the insertRule() Method

<html>
<script language="JScript">
<!--
cssMediaRuleObj.insertRule("media:screen", 1);
// -->
</script>
</html>

CSSMediaRule.media

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssMediaRuleObj.media

Description

The media property of the CSSMediaRule object is a read-only attribute of type MediaList. This is a list of media types for this rule.

Example

Listing 13.17 getting a CSSMediaRule and setting its media type.

Listing 13.17 Setting a Media Type Using the media Property

<html>
<script language="JScript">
<!--
mediaRuleObj.media = "handheld";
// -->
</script>
</html>

CSSPageRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSPageRule object represents a @page rule within a CSSStyleSheet. The CSSPageRule extends CSSRule. Table 13.4 lists all properties of the CSSPageRule object.

Table 13.4 Properties Associated with the CSSPageRule Object

Image

Example

Listing 13.18 demonstrates setting the selectorText property of a CSSPageRule object.

Listing 13.18 Setting the selectorText Property

<html>
<script language="JScript">
<!--
cssPageRuleObj.selectorText = "some selector text";
// -->
</script>
</html>

CSSPageRule.selectorText

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

CSSPageRule.selectorText

Description

The selectorText property of the CSSPageRule object is a read-only attribute of type String. The selectorText property is a textual representation of the page selector. This attribute can raise a DOMException with the values of NO_MODIFICATION_ ALLOWED_ERR and SYNTAX_ERR.

Example

Listing 13.19 demonstrates setting the selectorText property of a CSSPageRule object.

Listing 13.19 Setting the selectorText Property

<html>
<script language="JScript">
<!--
cssPageRuleObj.selectorText = "selection";
// -->
</script>
</html>

CSSPageRule.style

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssPageRuleObj.style

Description

The style property of the CSSPageRule object is a read-only attribute of type CSSStyleDeclaration. The style property represents the declaration block of this rule.

Example

Listing 13.20 demonstrates manipulating the style property of a CSSPageRule object.

Listing 13.20 Setting a Property of the style Property of the CSSPageRule Object

<html>
<script language="JScript">
<!--
cssPageRuleObj.style.size = "10";
// -->
</script>
</html>

CSSPrimitiveValue

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSPrimitiveValue object represents a CSSValue. This object can be used to determine or set a value for a specific style property. Table 13.5 lists all constants, properties, and methods of the CSSPrimitiveValue object.

Table 13.5 Arguments Associated with the CSSPrimitiveValue Object

Image

Image

Example

Listing 13.21 illustrates using the getRGBColor() method of the CSSPrimitiveValue object.

Listing 13.21 Using the getRGBColor() Method

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColor();

// -->
</script>
</html>

CSSPrimitiveValue.getCounterValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.getCounterValue()

Description

The getCounterValue() method of the CSSPrimitiveValue takes no arguments and returns a Counter object representing the Counter value. This method can raise a DOMException with the value of INVALID_ACCESS_ERR.

Example

Listing 13.22 Getting a counter value for the CSSPrimitiveValue object.

Listing 13.22 Reading the Counter Value Using the getCounterValue() Method

<html>
<script language="JScript">
<!--
var counterObj = cssPrimitiveValue.getCounterValue();
// -->
</script>
</html>

CSSPrimitiveValue.getFloatValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.getFloatValue(unitType)

Description

The getFloatValue() method of the CSSPrimitiveValue takes the argument unitType and returns a float value. This method can raise a DOMException with the value of INVALID_ACCESS_ERR.

Example

Listing 13.23 demonstrates the assigning of an event target and fires off an event.

Listing 13.23 Getting a Float Value Using the getFloatValue() Method of CSSPrimitiveValue Object

<html>
<script language="JScript">
<!--
var floatVal = cssPrimitiveValue.getFloatValue
(CSSPrimitiveValue.CSS_PERCENTAGE);
// -->
</script>
</html>

CSSPrimitiveValue.getRectValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.getRectValue()

Description

The getRectValue() method of the CSSPrimitiveValue takes no arguments and returns a Rect object representing a Rect value. This method can raise a DOMException with the value of INVALID_ACCESS_ERR.

Example

Listing 13.24 Illustrates getting a Rect value for the CSSPrimitiveValue object.

Listing 13.24 Getting a Rect Value Using the getRectValue() Method of the CSSPrimitiveValue Object

<html>
<script language="JScript">
<!--
var rectObj = cssPrimitiveValue.getRectValue();
// -->
</script>
</html>

CSSPrimitiveValue.getRGBColorValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.getRGBColorValue()

Description

The getRGBColorValue() method of the CSSPrimitiveValue takes no arguments and returns a RGBColor object representing the RGB Color value. This method can raise a DOMException with the value of INVALID_ACCESS_ERR.

Example

Listing 13.25 illustrates using the getRGBColorValue() method of the CSSPrimitiveValue object.

Listing 13.25 Using the getRGBColorValue() Method

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColorValue();
// -->
</script>
</html>

CSSPrimitiveValue.getStringValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.getStringValue()

Description

The getStringValue() method of the CSSPrimitiveValue object takes no arguments and returns a String value in the current unit. This method can raise a DOMException with the value of INVALID_ACCESS_ERR.

Example

Listing 13.26 Getting a string value for the CSSPrimitiveValue object.

Listing 13.26 Getting a String Value Using the getStringValue() Method of CSSPrimitiveValue

<html>
<script language="JScript">
<!--
var stringObj = cssPrimitiveValye.getStringValue();
// -->
</script>
</html>

CSSPrimitiveValue.primitiveType

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.primitiveType

Description

The primitiveType property of the CSSPrimitiveValue object is a read-only attribute of type Number. The primitiveType property is a Number representing the type of value as defined by the constants.

Example

Listing 13.27 demonstrates reading the primitiveType property of the CSSPrimitiveValue object.

Listing 13.27 Accessing the primitiveType Property

<html>
<script language="JScript">
<!--
if(cssPrimitiveValObj.primitiveType == CSSPrimitiveValue.CSS_STRING)
    processStringType(cssPrimitiveValObj.primitiveType);
// -->
</script>
</html>

CSSPrimitiveValue.setFloatValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.setFloatValue(unitType, floatType)

Description

The setFloatValue() method of the CSSPrimitiveValue takes the arguments unitType and floatType and has no return value. This method can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and INVALID_ACCESS_ERR.

Example

Listing 13.28 demonstrates setting a float value for CSSPrimitveValue.

Listing 13.28 Setting a float Value Using the setFloatValue() Method of the CSSPrimitiveValue Object

<html>
<script language="JScript">
<!--
cssPrimitiveValue.setFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE, 3.34);
// -->
</script>
</html>

CSSPrimitiveValue.setStringValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssPrimitiveValueObj.setStringValue(stringTypestringValue)

Description

The setStringValue() method of the CSSPrimitiveValue takes the arguments

stringType and stringValue and has no return value. This method can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and INVALID_ACCESS_ERR.

Example

Listing 13.29 setting a string value for the CSSPrimitiveValue object.

Listing 13.29 Setting a String Value Using the setStringValue() Method of the CSSPrimitvieVallue Object

<html>
<script language="JScript">
<!--
cssPrimitiveValue.setStringValue
         (CSSPrimitiveValue.CSS_STRING, "a random string");
// -->
</script>
</html>

CSSRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

CSSRule is an abstract base object for any CSS statement including the rules set and at rules. Table 13.6 lists all the properties of the CSSRule object.

Table 13.6 Properties Associated with the CSSRule Object

Image

Example

Listing 13.30 illustrates getting a CSSRules object and iterating through the list while checking each rule’s type.

Listing 13.30 Checking Rule Type

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
    var ruleObj = ruleList.index(i);
    if(ruleObj.type == UNKNOWN_RULE)
        handleUnknownRule(ruleObj);
    i++;
}
// -->
</script>
</html>

CSSRule.cssText

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssRuleObj.cssText

Description

The cssText property of the CSSRule object returns a string. This is a textual representation of the CSS rule. This String holds the current state of the CSS rule. This attribute can raise a DOMException with the values of HIERARCHY_REQUEST_ERR, NO_MODIFICATION_ALLOWED_ERR, INVALID_MODIFICATION_ERR, and SYNTAX_ERR.

Example

Listing 13.31 illustates the setting of the cssText property for a CSSRule object.

Listing 13.31 Setting CSS Text Using the cssText Property of the CSSRule Object

<html>
<script language="JScript">
<!--cssRule.cssText = "color:'green'; font-weight:bold";
// -->
</script>
</html>

CSSRule.parentRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssRuleObj.parentRule

Description

The read-only property parentRule of the CSSRule object is of type CSSRule. If this CSSRule is contained within another CSSRule, this is the containing rule. Otherwise this is Null.

Example

Listing 13.32 demonstrates reading the parentRule property.

Listing 13.32 Reading the parentRule Property

<html>
<script language="JScript">
<!--
if(cssRuleObj.parentRule.name = "myfontrule")
processRule(cssRuleObj.parentRule);
// -->
</script>
</html>

CSSRule.parentStyleSheet

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssRuleObj.parentStyleSheet

Description

The read-only property parentStyleSheet of the CSSRule object is of type CSSStyleSheet. Represents the style sheet that contains this rule.

Example

Listing 13.33 demonstrates reading the parentStyleSheet property.

Listing 13.33 Reading the parentStyleSheet Property

<html>
<script language="JScript">
<!--
if(cssRuleObj.parentStyleSheet.name = "mycss")
    processMyCSS(cssRuleObj.parentStyleSheet);
// -->
</script>
</html>

CSSRule.type

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssRuleObj.type

Description

The read-only property type of the CSSRule object returns a number indicating the type of rule.

Example

Listing 13.34 getting a CSSRules object and iterating through the list while checking each rule’s type.

Listing 13.34 Checking Rule Type Reading the type Property of CSSRule

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
    var ruleObj = ruleList.item(i);
    if(ruleObj.type == MEDIA_RULE)
        handleUnknownRule(ruleObj);
    i++;
}
// -->
</script>
</html>

CSSRuleList

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

CSSRuleList is an object that acts as an abstraction of an ordered collection of CSS Rules. Table 13.7 lists all properties and methods of the CSSRuleList object.

Table 13.7 Arguments Associated with the CSSRulesList Object

Image

Example

Listing 13.35 getting a CSSRuleList object and iterating through the list.

Listing 13.35 Iterating Through a CSSRuleList Object

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
    processRule(ruleList.item(i);
    i++;
}
// -->
</script>
</html>

CSSRuleList.item()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssRuleListObj.item(index)

Description

The item() method of the CSSRuleList takes the argument index. This method is used to retrieve the CSS rule by the ordinal index.

Example

Listing 13.36 getting a CSSRuleList object and iterating through the list.

Listing 13.36 Iterating Through a CSSRuleList Using the item() Method

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
       processRule(ruleList.item(i));
       i++;
}
// -->
</script>
</html>

CSSRuleList.length

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssRuleListObj.length

Description

The length property of the CSSRuleList object returns the number of CSS rules contained within the CSSRuleList.

Example

Listing 13.37 getting a CSSRuleList object and iterating through the list.

Listing 13.37 Reading the length Property of the CSSRuleList Object

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
       processRule(ruleList.item(i);
       i++;
}
// -->
</script>
</html>

CSSStyleDeclaration

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSStyleDeclaration object represents a CSS declaration block. CSSStyleDeclaration can be used to set or determine what style properties are set within the block. Table 13.8 lists all properties and methods of the CSSStyleDeclaration object.

Table 13.8 Arguments Associated with the CSSMediaRule Object

Image

Example

Listing 13.38 demonstrates setting the CSSText property of the CSSStyleDeclation object.

Listing 13.38 Setting the CSSText Property

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.cssText = "color:'green'; font-weight:bold";
// -->
</script>
</html>

CSSStyleDeclaration.cssText

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.cssText

Description

The cssText property of the CSSStyleDeclaration object is a textual representation of the declaration block. Setting this attribute will reset all properties set in this declaration block. This attribute can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and SYNTAX_ERR.

Example

Listing 13.39 demonstrates setting the cssText property of CSSStyleDeclaration object.

Listing 13.39 Setting the cssText Property

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.cssText = "color:'red'; font-weight:bold";
// -->
</script>
</html>

CSSStyleDeclaration.getPropertyCSSValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStuleDeclObj.getPropertyCSSValue(propertyName)

Description

The getPropertyCSSValue() method of the CSSStyleDeclaration takes the argument string propertyName and returns a CSSValue representing the value of the property of the property that has been set. Returns Null if the property hasn’t been set.

Example

Listing 13.40 illustrates getting a property value using the getPropertyCSSValue() method of CSSStyleDeclaration.

Listing 13.40 Invoking the getPropertyCSSValue() Method

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.getPropertyCSSValue("height");
// -->
</script>
</html>

CSSStyleDeclaration.getPropertyPriority()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDecl.getPropertyPriority(propertyName)

Description

The getPropertyPriority() method of the CSSStyleDeclaration takes the argument propertyName and returns a String representing the priority of the CSS property. Returns an empty string if none exists.

Example

Listing 13.41 illustrates getting a property value using the getPropertyPriority() method of CSSStyleDeclaration.

Listing 13.41 Getting the Property Priority Using the getPropertyPriority() Method

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.getPropertyPriority("height");
// -->
</script>
</html>

CSSStyleDeclaration.getPropertyValue()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.getPropertyValue(propertyName)

Description

The getPropertyValue() method of the CSSStyleDeclaration takes the argument propertyName and returns a String representing the value of the property in the declaration block. Returns an empty string if the property hasn’t been set.

Example

Listing 13.42 illustrates getting a property value using the getPropertyValue() method of CSSStyleDeclaration.

Listing 13.42 Getting a Named Property Value Using the getPropertyValue() Method

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.getPropertyValue("height"); 
// -->
</script>
</html>

CSSStyleDeclaration.item()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

cssStyleDeclarationObj.item(index)

Description

The item() method of the CSSStyleDeclaration takes the argument index and returns a String representing the name of the property at the ordinal position.

Example

Listing 13.43 illustrates getting a CSSValue and setting its value type.

Listing 13.43 Invoking the item() Method

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
var cssValueObj = cssStyleDeclarationObj.getPropertyCSSValue("height");
document.write(cssValueObj.cssValueType);
// -->
</script>
</html>

CSSStyleDeclaration.length

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.length

Description

The length property of the CSSStyleDeclaration object is a read-only attribute of type Number. Length is the number of properties that have been set in this declaration block.

Example

Listing 13.44 illustrates reading the length property of CSSStyleDeclaration.

Listing 13.44 Getting the length Property

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
document.write(cssStyleDeclarationObj.length);
// -->
</script>
</html>

CSSStyleDeclaration.parentRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.parentRule

Description

The parentRule read-only property of the CSSStyleDeclaration object. The parentRule property represents the CSSRule that contains this declaration block or is Null if this block isn’t contained in a CSSRule.

Example

Listing 13.45 illustrates reading the parentRule property of CSSStyleDeclaration.

Listing 13.45 Setting the parentRule Property

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
document.write(cssStyleDeclarationObj.parentRule);
// -->
</script>
</html>

CSSStyleDeclaration.removeProperty()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.removeProperty(propertyName)

Description

The removeProperty() method of the CSSStyleDeclaration takes the argument propertyName and returns a String representing the value of the property that has been set. Returns an empty string if the property hasn’t been set. This method can raise a DOMException with the value of NO_MODIFICATION_ALLOWED_ERR.

Example

Listing 13.46 illustrates getting a property value using the removeProperty() method of CSSStyleDeclaration.

Listing 13.46 Removing a Property Using the removeProperty() Method of the CSSStyleDeclaration Object

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
cssStyleDeclarationObj.removeProperty("height");
// -->
</script>
</html>

CSSStyleDeclaration.setProperty()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleDeclObj.setProperty(propertyName, value, priority)

Description

The setProperty() method of the CSSStyleDeclaration takes the arguments string propertyName, string value, string priority, and has no return value. This method can raise a DOMException with the value of NO_MODIFICATION_ALLOWED_ERR.

Example

Listing 13.47 illustrates setting a property value using the setProperty() method of CSSStyleDeclaration.

Listing 13.47 Setting a Property Value Using the setProperty() Method of CSSStyleDeclaration Object

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.Item(0);
cssStyleDeclarationObj.setProperty("height", "35");
// -->
</script>
</html>

CSSStyleRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

CSSStyleRule is an object representing a single rule set in a CSSStyleSheet. CSSStyleRule extends CSSRule. Table 13.9 lists all properties of the CSSStyleRule object.

Table 13.9 Properties Associated with the CSSRule Object

Image

Example

Listing 13.48 gets a CSSStyleRule object and sets its selectorText property.

Listing 13.48 Assigning and Sending an Event

<html>
<script language="JScript">
<!--
var cssStyleRuleObj = bodObj.style;
cssStyleRuleObj.selectorText = "some text";
// -->
</script>
</html>

CSSStyleRule.selectorText

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleRuleObj.selectorText

Description

The selectorText of the CSSStyleRule object is a read-only attribute of type string. This is a textual representation of the selector of this rule set. This attribute can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR and SYNTAX_ERR.

Example

Listing 13.49 getting a CSSStyleRule object and setting its selectorText property.

Listing 13.49 Setting selectorText

<html>
<script language="JScript">
<!--
var cssStyleRuleObj = bodObj.style;
cssStyleRuleObj.selectorText = "selector text";
// -->
</script>
</html>

CSSStyleRule.style

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleRuleObj.style

Description

The style property of the CSSStyleRule object is a read-only property of type CSSStyleDeclaration. This contains the declarative block of the rule set.

Example

Listing 13.50 demonstrates the assignment of a value to the height property of the style property of the CSSStyleRule object.

Listing 13.50 Writing the style Property of the CSSStyleRule Object

<html>
<script language="JScript">
<!--
cssStyleRuleObj.style.height = 24;
// -->
</script>
  </html>

CSSStyleSheet

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSStyleSheet object is used to represent a CSS style sheet. This object allows access to the collection of rules within a CSS StyleSheet. Table 13.10 lists all properties and methods of the CSSStyleSheet object.

Table 13.10 Arguments Associated with the CSSStyleSheet Object

Image

Example

Listing 13.51 demonstrates the creation of a CSSStyleSheetObject.

Listing 13.51 Creating a CSSStyleSheet Object

<html>
<script language="JScript">
<!--
var cssStyleSheetObj = DOMImplementationCSS.createCSSStyleSheet
        ("mycss", "handheld");
// -->
</script>
</html>

CSSStyleSheet.cssRules

JavaScript 1.5+,

JScript 5+ Nav6+, IE5+

 

Syntax

cssStyleSheetObj.cssRules

Description

The cssRules property of the CSSStyleSheet object is a read-only property that is of type CSSRuleList object. cssRules is a list of all rules contained within the style sheet and includes both rule sets and at-rules.

Example

Listing 13.52 demonstrates iterating through the list of cssRules and displaying the type of each.

Listing 13.52 Iterating Through cssRules

<html>
<script language="JScript">
<!--
var rulesList = cssStyleSheetObj.cssRules;
var i = 0;
while(i < ruleList.length) {
       display(ruleList.Index(i).type);
       i++;
}
// -->
</script>
</html>

CSSStyleSheet.deleteRule()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleSheetObj.deleteRule(index)

Description

The deleteRule() method of the CSSStyleSheet takes the argument index. This method is used to remove a rule from the style sheet at position index. This method can raise a DOMException with the values of INDEX_SIZE_ERR and NO_MODIFICATION_ALLOWED_ERR.

Example

Listing 13.53 demonstrates removing a CSSRule from the stylesheet.

Listing 13.53 Removing a Rule Using the deleteRule() Method of the CSSStyleSheet Object

<html>
<script language="JScript">
<!--
cssStyleSheetObj.deleteRule(0);
// -->
</script>
</html>

CSSStyleSheet.insertRule()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleSheetObj.insertRule(rule, index)

Description

The insertRule() method of the CSSStyleSheet takes the arguments rule and index and returns the index of the newly inserted rule. This method can raise a DOMException object with the values of HIERARCHY_REQUEST_ERR, INDEX_SIZE_ERR, NO_MODIFICATION_ALLOWED_ERR, and SYNTAX_ERR.

Example

Listing 13.54 illustrates inserting a new CSSRule into the style sheet.

Listing 13.54 Inserting a CSSRule Using the insertRule() Method of the CSSStyleSheet Object

<html>
<script language="JScript">
<!--
cssStyleSheetObj.insertRule("margin-top: 1ex", 0);
// -->
</script>
</html>

CSSStyleSheet.ownerRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssStyleSheetObj.ownerRule

Description

This is a read-only attribute that is of type CSSRule object. ownerRule can contain both rule sets and at-rules.

Example

Listing 13.55 demonstrates reading the ownerRule property.

Listing 13.55 Reading ownerRule

<html>
<script language="JScript">
<!--
if(cssStyleSheetObj.ownerRule.type = "Media") {
       handleMediaRuler(cssStyleSheetObj.ownerRule);
// -->
</script>
</html>

CSSUnknownRule

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSUnknownRule object represents an at-rule that isn’t supported. It inherits all methods and properties from CSSRule.

Example

Listing 13.56 getting a CSSRules object and iterating through the list while checking to see whether the rule type is a CSSUnknownRule.

Listing 13.56 Checking the type Property of the CSSUnknownRule Object

<html>
<script language="JScript">
<!--
var ruleList = cssStyleSheetObj.rules;
var i = 0;
while( i < ruleList.length) {
       var ruleObj = ruleList.item(i);
       if(ruleObj.Type == UNKNOWN_RULE)
       handleUnknownRule(ruleObj);
       i++;
}
// -->
</script>
</html>

CSSValue

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSValue object represents a simple or complex value within the context of a CSS property. Table 13.11 lists all constants and properties of the CSSValue object.

Table 13.11 Arguments Associated with the CSSValue Object

Image

Example

Listing 13.57 illustrates getting a CSSValue and setting its value type.

Listing 13.57 Getting a Property

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
var cssValueObj = cssStyleDeclarationObj.getPropertyCSSValue("height");
document.write(cssValueObj.cssValueType);
// -->
</script>
</html>

CSSValue.cssText

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssValueObj.cssText

Description

The cssText property of the CSSValue object is of type string. The cssText property is a textual representation of the current value. This attribute can raise a DOMException with the values of NO_MODIFICATION_ALLOWED_ERR, INVALID_MODIFICATION_ERROR, and SYNTAX_ERR.

Example

Listing 13.58 illustrates getting a CSSValue and setting its value type.

Listing 13.58 Reading the cssText Property of the CSSValue Object

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
var cssValueObj = cssStyleDeclarationObj.getPropertyCSSValue("height");
document.write(cssValueObj.cssText);
// -->
</script>
</html>

CSSValue.cssValueType

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssValueObj.cssValueType

Description

The read-only property cssValueType of the CSSValue object is of type Number. The cssValueType property is a code defining the type of value.

Example

Listing 13.59 illustrates getting a CSSValue and setting its value type.

Listing 13.59 Reading the cssValueType Property of the CSSValue Object

<html>
<script language="JScript">
<!--
var cssStyleDeclarationObj = cssStyleSheetObj.cssRules.item(0);
var cssValueObj = cssStyleDeclarationObj.getPropertyCSSValue("height");
document.write(cssValueObj.cssValueType);
// -->
</script>
</html>

CSSValueList

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The CSSValueList object is an abstraction of an ordered collection of CSSValues. Table 13.12 lists the property and method of the CSSValue object.

Table 13.12 Arguments Associated with the CSSValueList Object

Image

Example

Listing 13.60 illustrates iterating through a CSSValueList object.

Listing 13.60 Iterating Through a CSSValueList

<html>
<script language="JScript">
<!--
var i = 0;

while(i < valueListObj.length) {

       var listItem = valueListObj.item(i);
       processListItem(listItem);
       i++;
}
// -->
</script>
</html>

CSSValueList.item()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssValueListObj.item(index)

Description

The item() method of the CSSValueList takes the argument Number index and returns the CSSValue at the index position in the list.

Example

Listing 13.61 illustrates iterating through a CSSValueList object.

Listing 13.61 Invoking the item() Method of the CSSValueList Object

<html>
<script language="JScript">
<!--
var i = 0;

while(i < valueListObj.length) {
       var listItem = valueListObj.item(i);
       processListItem(listItem);
       i++;
}
// -->
</script>
</html>

CSSValueList.length

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

cssValueListObj.length

Description

This read-only attribute is of type Number. Length is a number representing the number of CSSValue objects in the list.

Example

Listing 13.62 illustrates iterating through a CSSValueList object.

Listing 13.62 Reading the length Property of the CSSValueList Object

<html>
<script language="JScript">
<!--
var i = 0;

while(i < valueListObj.length) {
       var listItem = valueListObj.item(i);
       processListItem(listItem);
       i++;
}
// -->
</script>
</html>

DocumentCSS

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The DocumentCSS object represents a document with a CSS view. The method associated with the DocumentCSS object is as follows:

Item

Description

getOverrideStyle()

This method returns a CSSStyleSheet representing the override style declaration.

Example

Listing 13.63 demonstrates getting the overridden style of a particular element.

Listing 13.63 Overriding the Style

<html>
<script language="JScript">
<!--
documentCSSObj.getOverrideStyle(bodyObj, null);
// -->
</script>
</html>

DocumentCSS.getOverrideStyle()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

documentCSSObj.getOverrideStyle(eltpseudoElt)

Description

The getOverrideStyle() method of the DocumentCSS takes the arguments Element elt and String pseudoElt and returns the override style declaration.

Example

Listing 13.64 demonstrates getting the overridden style of a particular element.

Listing 13.64 Overriding the Style Using the getOverrideStyle() Method of the DocumentCSS Object

<html>
<script language="JScript">
<!--
documentCSSObj.getOverrideStyle(tableObj, null);
// -->
</script>
</html>

DOMImplementationCSS

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOM CSS Object.

Description

The DOMImplementationCSS object represents the ability for the DOM user to create a CSSStyleSheet outside the context of the document. The method associated with the DOMImplementationCSS object is as follows:

Item

Description

createCSSStyleSheet

This method returns a CSSStyleSheet object representing the new CSSStyleSheet.

Example

Listing 13.65 demonstrates creating a new style sheet.

Listing 13.65 Creating a New Style Sheet

<html>
<script language="JScript">
<!--
var cssStyleSheetObj = DOMImplementation.createCSSStyleSheet("my css",
"print");
// -->
</script>
</html>

DOMImplementationCSS.createCSSStyleSheet()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

 

Syntax

DOMImplementationCSS.createCSSStyleSheet(title, media)

Description

The CreateCSSStyleSheet() method of the DOMImplementationCSS takes the arguments String title and String media and returns a new CSSStyleSheet. This method can raise a DOMException with the value of SYNTAX_ERR.

Example

Listing 13.66 demonstrates creating a new style sheet.

Listing 13.66 Creating a New Style Sheet Using the createCSSStyleSheet() Method of the DOMImplementationCSS Object

<html>
<script language="JScript">
<!--
var cssStyleSheetObj = DOMImplementation.createCSSStyleSheet("my css",
"print");
// -->
</script>
</html>

ElementCSSInlineStyle

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

The ElementCSSInlineStyle object represents the contents of the style attribute for HTML elements. The property associated with the ElementCSSInlineStyle object is as follows:

Image

Example

Listing 13.67 demonstrates reading the style property from the ElementCSSInlineStyle object.

Listing 13.67 Reading the style Property

<html>
<script language="JScript">
<!--
var cssStyleDef = elementCSSInlineStyleObj.style;
// -->
</script>
</html>

ElementCSSInlineStyle.style

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

elementCSSInlineStyleObj.style

Description

The read-only property style of the ElementCSSInlinestyle object is of type CSSStyleDeclaration.style is a textual representation of the style for HTML elements.

Example

Listing 13.68 demonstrates reading the style property from the ElementCSSInlineStyle object.

Listing 13.68 Reading the style Property

<html>
<script language="JScript">
<!--
var cssStyleDef = elementCSSInlineStyleObj.style;
// -->
</script>
</html>

Rect

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

The Rect object represents any Rect value. Rect reflects the values in the style properties. Modifications in the style properties are reflected in this object. Table 13.13 lists all properties of the Rect object.

Table 13.13 Properties Associated with the Rect Object

Image

Example

Listing 13.69 illustrates reading the properties of the Rect object.

Listing 13.69 Reading Properties of the Rect Object

<html>
<script language="JScript">
<!--
var rectObj = primitiveValObj.getRectValue();
var topVal = rectObj.top;
var rightVal = rectObj.right;
var bottomVal = rectObj.bottom;
var leftVal = rectObj.left;
// -->
</script>
</html>

Rect.bottom

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

rectObj.bottom

Description

The read-only property bottom of the Rect object is of type CSSPrimitiveValue.bottom represents the bottom of the Rect.

Example

Listing 13.70 illustrates reading the bottom property of the Rect object.

Listing 13.70 Reading the bottom Property of the Rect Object

<html>
<script language="JScript">
<!--
var rectObj = primitiveValObj.getRectValue();
var bottomVal = rectObj.bottom;
// -->
</script>
</html>

Rect.left

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

Rect.left

Description

The read-only property left of the Rect object is of type CSSPrimitiveValue.Left represents the left of the Rect.

Example

Listing 13.71 illustrates reading the left property of the Rect object.

Listing 13.71 Reading the left Property of the Rect Object

<html>
<script language="JScript">
<!--
var rectObj = primitiveValObj.getRectValue();
var leftVal = rectObj.left;
// -->
</script>
</html>

Rect.right

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

Rect.right

Description

The read-only property right of the Rect object is of type CSSPrimitiveValue.Right represents the right of the rectangle.

Example

Listing 13.72 illustrates reading the right property of the Rect object.

Listing 13.72 Reading the right Property of the Rect Object

<html>
<script language="JScript">
<!--
var rectObj = primitiveValObj.getRectValue();
var rightVal = rectObj.right; 
// -->
</script>
</html>

Rect.top

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

Rect.top

Description

The read-only property top of the Rect object is of type CSSPrimitiveValue. The top property represents the top of the Rect.

Example

Listing 13.73 illustrates reading the top property of the Rect object.

Listing 13.73 Reading the top Property of the Rect Object

<html>
<script language="JScript">
<!--
var rectObj = primitiveValObj.getRectValue();
var topVal = rectObj.top;
// -->
</script>
</html>

RGBColor

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

The RGBColor object is a representation of any RGB color value. RGBColor reflects the values in the style properties. Modifications in the style properties are reflected in this object. Table 13.14 lists all properties of the RGBColor object.

Table 13.14 Properties Associated with the RGBColor Object

Image

Example

Listing 13.74 illustrates the manipulation of the RGBColor object.

Listing 13.74 Reading Properties of the RGBColor Object

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColor();
var redVal = rgbColorObj.red;
var greenVal = rgbColorObj.green;
var blueVal = rgbColorObj.blue;

// -->
</script>
</html>

RGBColor.blue

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

rgbColorObj.blue

Description

The read-only property blue of the RGBColor object is of type CSSPrimitiveValue. blue is used to represent the blue value of the RGB color.

Example

Listing 13.75 illustrates the manipulation of the RGBColor object.

Listing 13.75 Reading the blue Property of the RGBColor Object

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColor(); 
var blueVal = rgbColorObj.blue;
// -->
</script>
</html>

RGBColor.green

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

rgbColor.green

Description

The read-only property green of the RGBColor object is of type CSSPrimitiveValue. green is used to represent the green value of the RGB color.

Example

Listing 13.76 illustrates the manipulation of the RGBColor object.

Listing 13.76 Reading the green Property of the RGBColor Object

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColor();
var greenVal = rgbColorObj.green;
// -->
</script>
</html>

RGBColor.red

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

rgbColor.red

Description

The read-only property red of the RGBColor object is of type CSSPrimitiveValue. Red is used to represent the red value of the RGB color.

Example

Listing 13.77 illustrates the manipulation of the RGBColor object.

Listing 13.77 Reading the red Property of the RGBColor Object

<html>
<script language="JScript">
<!--
var rgbColorObj = primitiveValObj.getRGBColor();
var redVal = rgbColorObj.red;

// -->
</script>
</html>

ViewCSS

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

DOM CSS Object.

Description

The ViewCSS object represents a CSS view. The method associated with the ViewCSS object is as follows:

Image

Example

Listing 13.78 demonstrates getting the computed style of a particular element.

Listing 13.78 Computing the Style

<html>
<script language="JScript">
<!--
viewCSSObj.getComputerStyle(bodyObj, null);
// -->
</script>
</html>

ViewCSS.getComputedStyle()

JavaScript 1.5+, JScript 5+

Nav6+, IE5+

Syntax

viewCSSObj.getComputedStyle(elt, pseudoElt)

Description

The getComputedStyle() method of the ViewCSS object takes the arguments Element elt and String pseudoElt and returns the computed style.

Example

Listing 13.79 demonstrates getting the computed style of a particular element.

Listing 13.79 Computing the Style Using the getComputedStyle() Method of the ViewCSS Object

<html>
<script language="JScript">
<!--
viewCSSObj.getComputerStyle(tableObj, null);
// -->
</script>

ON THE CD-ROM

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.115.120