Creates a new row (tr) in the table, and adds the row to the rows collection.
![]() |
Syntax
object.insertRow(index)Parameters
- index [in, optional]
-
Type: Integer
Integer that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection.
Return value
Type: Object
Returns the tr element object if successful, ornull otherwise. Standards information
- Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5
Remarks
The preferred technique for inserting a row is to add the row at the end of the rows collection. It is faster to add a row at the end of a table than somewhere in the middle. To add a row at the end of the collection, specify the -1 value, or the length of the rows collection minus 1.
Examples
This example uses the insertRow method to add a row to the table.
myNewRow = document.all.myTable.insertRow()
See also
Build date: 11/28/2012
