<html> <head> <script type="text/javascript"> function addRows() { var tbodyElem = document.getElementById("myTbody"); row0 = tbodyElem.insertRow(0); row0.insertCell(0).appendChild(document.createTextNode("Row_0")); row4 = tbodyElem.insertRow(tbodyElem.rows.length); row4.insertCell(0).appendChild(document.createTextNode("Row_4")); row5 = tbodyElem.insertRow(-1); row5.insertCell(0).appendChild(document.createTextNode("Row_5")); row6 = tbodyElem.insertRow(100); row6.insertCell(0).appendChild(document.createTextNode("Row_6")); } </script> </head> <body onLoad="addRows()"> <p>You should see a table with 6 rows, labeled "Row_0", "Row_1", "Row_2", "Row_3", "Row_4", "Row_5", from top to bottom.</p> <table border=1 id="myTbody"> <tr> <td>Row_1</td> </tr> <tr> <td>Row_2</td> </tr> <tr> <td>Row_3</td> </tr> </table> </body> </html>