| <!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 - insertCell()</title> |
| </head> |
| <body> |
| |
| <h1>insertCell() bugs, 0 based</h1> |
| |
| <table border> |
| <tbody> |
| <tr id="touse"> |
| <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 newcell = touse.insertCell(i); |
| newcell.appendChild( |
| document.createTextNode("This is cell number " + i + ".") |
| ) |
| } |
| |
| |
| </script> |
| |
| </body> |
| </html> |