Javascript Reference
Categories: TBODY

javascript TBODY insertRow( )

@April 4, 2009, 2:57 a.m.
insertRow( ) Firefox/Netscape/NN 6 IE 4(Win) Chrome/Safari/DOM 1  



Inserts a tr element nested within the current tbody, tfoot, or thead element. The integer parameter points to the zero-based index in the rows collection where the new row should go, but in IE you can also use the shortcut value of -1 to append the row to the end of the collection. Adding the row inserts an empty element, to which you add cells via the insertCell( ) method. Unfortunately, scripting the addition of table rows and cells in IE for the Macintosh (including Version 5.1) is very broken, yielding elephantine row and cell dimensions. For nonnested tables, you might be able to get away with regular document tree node creation and insertion instead of the table section object convenience methods.

  • Zero-based integer corresponding to a row of the rows collection before which the new row is to be inserted.
Returned Value

Reference to the newly inserted row.

Powered by Linode.