The Tbodies Collection

Note : The Tbodies collection is Internet Explorer 4.0 specific. As Netscape doesn't support the <TBODY> element, it doesn't support the Tbodies collection.

The Tbodies collection returns a collection of <TBODY> elements for a referenced <TABLE>. Note that Internet Explorer 4.0 inserts <TBODY> elements (for the All collection) whether they have been used in <TABLE> elements or not.

For example:

intRows=document.all.TABLE1.tbodies(0).rows.length

would make intRows the number of Rows in the referenced <TABLE> elements first <TBODY> section.

Properties

length
The length property returns the number of elements in the collection. Note that the length count starts at 1, not 0 as the tbodies collection index does.

Methods

item
The item method retrieves single items, or sub-collections from the tbodies collection. It accepts the following arguments:

...tbodies.item(index, sub-index)

If index is a number, then the method returns a reference to the <TBODY> element object at that position in the tbodies collection, for the referenced <TABLE>.

If the index property is a string value, then the item method returns a sub-collection, containing a reference to every <TBODY> element in the collection that has its ID or NAME attribute set to the string contained in the index argument. To retrieve certain element objects from this sub-collection, the sub-index argument must be used.

tags
The tags method returns a collection of <TBODY> element objects whose tagName property is the same as the tag argument used for the method. This differs from the item property in that that interrogates ID and NAME values if necessary.