| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> |
| <html> |
| <head> |
| <title>Table element insertion bugs - insertRow()</title> |
| </head> |
| <body> |
| |
| <h1>insertRow() bugs, 0 based</h1> |
| |
| <table border> |
| <tbody id="touse"> |
| <tr> |
| <td> |
| This is just dummy text. |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <script type="text/javascript"> |
| |
| |
| var touse = document.getElementById("touse"); |
| |
| while (touse.hasChildNodes() ) { |
| touse.removeChild(touse.firstChild); |
| } |
| |
| /* i could be 0 or 1 - whatever is first ends up at the end */ |
| for ( var i = 0 ; i < 6; i++ ) { |
| var newrow = touse.insertRow(i); |
| var newcell = newrow.insertCell(0); |
| newcell.appendChild( |
| document.createTextNode("This is row number " + i + ".") |
| ) |
| } |
| |
| |
| </script> |
| |
| </body> |
| </html> |