<HEAD> | |
<SCRIPT> | |
function insertRow() { | |
tb = document.getElementById("tb"); | |
fr = tb.childNodes[0]; | |
nr = document.createElement("TR"); | |
nc = document.createElement("TD"); | |
nc.appendChild(document.createTextNode("second row")); | |
nr.appendChild(nc); | |
tb.insertBefore(nr,fr); | |
} | |
</SCRIPT> | |
</HEAD> | |
<BODY> | |
<TABLE> | |
<THEAD> | |
<TR> | |
<TD>The head</TD> | |
</TR> | |
</THEAD> | |
<TBODY ID="tb"> | |
<TR> | |
<TD>First row</TD> | |
</TR> | |
</TBODY> | |
</TABLE> | |
<FORM> | |
<INPUT type=button value="insert" onclick="insertRow();"> | |
</FORM> | |
</BODY> |