DHTML Methods
Inserts a new empty row ( TR ) in a TABLE.
oTR = object.insertRow ( [ iIndex ] )
iIndex |
Optional. The row number where to insert the new row. This index starts from 0 and is relative to all the rows contained inside the table, regardless of section parentage. The default value is -1, which appends the new row to the end of the rows collection. |
Returns the newly created TR object if successful, or null otherwise.
The new row is inserted immediately before and in the same section as the current indexth row in the table. If iIndex is equal to the number of rows, the new row is appended. In addition, when the table is empty, the row is inserted into a TBODY which is created and inserted into the table. Note however that a table row cannot be empty according to HTML 4.0 recommendation.
Inserting a row in a TFOOT, TBODY, or THEAD also adds a row to the rows collection for the TABLE.
Inserting a row in the TABLE adds a row to the rows collection for the TBODY. If specifying an index, the index should be relative to the rows collection for the element which first contains the TR. For example, calling this method for a TBODY would take an index value relative to the rows collection that is on the TBODY, not the TABLE.
The following example adds a row to the TABLE.
myNewRow = document.all.myTable.insertRow ( )
TABLE, TBODY, TFOOT, THEAD
insertCell, rows, rowIndex, sectionRowIndex