rowsNN 6 IE 4 DOM 1  

  

Provides a collection of all tr element objects contained in a single table, tbody, tfoot, or thead element object. The rows collection of a table element includes all rows of the table, regardless of row groups. Collection members are sorted in source code order. Internet Explorer lets you use array notation or parentheses to access a single row in the collection (e.g., document.getElementById("myTable").rows[0], document.all.myTable.rows (0)).

 
Object Model Reference
 
document.getElementById("tableOrSectionID").rows
 
Object-Specific Properties
 
length
 
Object-Specific Methods
 
item( )namedItem( )tags( )urns( )
 
Object-Specific Event Handler Properties

None.

lengthNN 6 IE 4 DOM 1  

Read-only  

Returns the number of elements in the collection.

 
Example
 
var howMany = document.getElementById("myTable").rows.length;
 
Value

Integer.

item( )NN 6 IE 4 DOM 1  

item(index[, subindex]) item(index)

  

Returns a single tr object or collection of tr objects corresponding to the element matching the index value (or, optionally in IE, the index and subindex values).

 
Parameters
 
  • When the parameter is a zero-based integer, the returned value is a single element corresponding to the specified item in source code order (nested within the current element); when the parameter is a string (IE only), the returned value is a collection of elements with id properties that match that string.
  • In IE only, if you specify a string value for the first parameter, you can use the second parameter to specify a zero-based index that retrieves the specified element from the collection with id properties that match the first parameter's string value.
 
Returned Value

One tr object or collection (array) of tr objects. If there are no matches to the parameters, the returned value is null.

namedItem( )NN 6 IE 6 DOM 1  

namedItem("ID")

  

Returns a single tr object or collection of tr objects corresponding to the element matching the parameter string value.

 
Parameters
 
  • The string that contains the same value as the desired element's id attribute.
 
Returned Value

One tr object or collection (array) of tr objects. If there are no matches to the parameters, the returned value is null.

tags( )NN n/a IE 4 DOM n/a  

tags(tagName)

  

Returns a collection of objects (among all objects within the current collection) with tags that match the tagName parameter. Redundant here, because all elements have the same tr tag.

 
Parameters
 
  • This involves a string of the all-uppercase version of the element tag, for example, document.getElementById("myTable").rows.tags("tr").
 
Returned Value

A collection (array) of objects. If there are no matches to the parameters, the returned value is an array of zero length.

urns( )NN n/a IE 5(Win) DOM n/a  

urns(URN)

  

See the all.urns( ) method.