plugins
Collections Reference

plugins

Description

This is an alias for the embeds collection on the document.

Syntax

object.plugins(index)

ParameterDescription
object The document object.
(index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is a name or identifier of at least one element in the document.

Remarks

This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Property

length

Methods

item, tags

Applies To

document


rows

Description

Retrieves a collection of rows (TR elements) in the table. The scope of this collection is for the THEAD, TBODY, or TFOOT of the table. In addition, there is also a rows collection for the TABLE, which contains all the rows for the entire table. A row that appears in one of the table sections also appears in the rows collection for the TABLE. The TR has two index properties, "rowIndex" and "sectionRowIndex", which indicate where, with respect to the rows collection for the given table section, and where with respect to the rows collection for the table in which the TR appears.

Syntax

object.rows(index)

ParameterDescription
object A TABLE, TBODY, THEAD, or TFOOT element.
index Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document.

Remarks

If duplicate identifiers are found, a collection of those items is returned. Collections of duplicates must subsequently be referenced by ordinal position.

Example

The following example uses the rows and cells collections to insert a number into each cell of the table.

<HTML>
<SCRIPT LANGUAGE="JScript">
function numberCells() {
    var count=0;
    for (i=0; i < document.all.mytable.rows.length; i++) {
        for (j=0; j < document.all.mytable.rows(i).cells.length; j++) {
            document.all.mytable.rows(i).cells(j).innerText = count;
            count++;
        }
    }
}
</SCRIPT>
<BODY onload="numberCells()">
<TABLE id=mytable border=1>
<TR><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH></TR>
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
</TABLE>
</BODY>
</HTML> 

Applies To

table, TBODY, TFOOT, THEAD

Property

length

Methods

item, tags


rules

Description

Retrieves a collection of rules that are defined in the style sheet. This collection is always accessible, and can be accessed even if the style sheet is not enabled. Rules are added and removed from the rules collection with add and remove methods on the individual style sheet. A rule that is added to a disabled style sheet will not apply to the document unless the style sheet's disabled property is changed to false.

The rules in this collection are in the source order of the document. Style rules linked in using the "@import" syntax of CSS should be expanded in-place in this collection according to the CSS1 specification.

As rules are added or deleted through the CSSOM, a rule's absolute position in the rules collection might change, but its position relative to other rules will remain the same. The default location to add a new rule (without specifying an index) is at the end of the collection, which is the highest precedence (not accounting for selector specificity, as according to the CSS specification) and is applied to the document last. If an index is supplied, the rule should be inserted before the rule currently in that ordinal position in the collection, or, if the index is larger than the number of rules in the collection, it should be added to the end.

Syntax

object.rules(index)

ParameterDescription
(index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document.

Property

length

Applies To

styleSheet


scripts

Description

Retrieves a collection of all SCRIPT elements in the document.

Syntax

object.scripts(index)

ParameterDescription
object The document object.
(index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document.

Remarks

This collection contains all the scripts in the document in source order regardless of the script's location in the document (whether in the HEAD or BODY).

If duplicate identifiers are found, a collection of those items is returned. Collections of duplicates must subsequently be referenced by ordinal position.

Property

length

Methods

item, tags

Applies To

document


styleSheets

Description

Retrieves a collection of styleSheets objects representing the style sheets corresponding to each instance of a LINK or STYLE element in the document. Imported style sheets are contained within a STYLE element and are available through the imports collection.

Syntax

object.styleSheets(index)

ParameterDescription
object The document object.
(index) Optional. An integer or a string specifying the index value of the style sheet to retrieve. Integer indexes are zero-based, meaning the first style sheet in the collection has index 0.

Example

The following example displays the titles of the style sheets in the document.

for (i=0; i<document.styleSheets.length; i++) {
    alert("Style sheet " + i + " is titled " + document.styleSheets(i).title);
}

Property

length

Methods

item

Applies To

document


tbodies

Description

Retrieves a collection of all TBODY elements in the table. Elements in this collection are in HTML source order.

Syntax

object.tbodies(index)

ParameterDescription
object The table object.
index An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid if the string is an identifier of at least one element in the scope of the collection.

This collection can be indexed by name (ID). If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.

Example

The following example puts text in the first cell in the first row of the first TBODY element in the TABLE. For each TABLE, an initial TBODY element is synthesized in the HTML tree even if one does not exist in the HTML source.


document.all.mytable.tbodies[0].rows[0].cells[0].innerText="Text for the first table cell";

Applies To

table

Property

length

Methods

item, tags

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.