[Javascript] insertRow at a certain index

Hakan Magnusson hakan at backbase.com
Mon Jun 7 08:07:19 CDT 2004


oTableBody.insertBefore(oNewTableRow, oTableRowToBePlacedBefore);

oTableBody is the <body> of the table
oNewTableRow is your new, freshly created table row
oTableRowToBePlacedBefore is an allready existing row in the table, and 
your oNewTableRow will be placed just before this row.

In the sweet words of the Mozilla DOM reference:

insertedElement = element.insertBefore( newElement, targetElement )

http://www.mozilla.org/docs/dom/domref/dom_el_ref47.html
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/insertbefore.asp

Regards,
H

Paul Cowan wrote:
> Hi,
> 
> I know I can dynamically add a row to the bottom of an HTML table but is 
> it possible to add a row at a certain index?
> 
> Thanks
> 
> Paul
> 
> 
> 
> dagda1 at hotmail.com
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list