A
Amir Hardon
I'm new to DOM and can't figure out this thing:
I'm trying to add a row to a table with a form field in one
of it's cells, but if I'm appending the field to a form
it gets out of the table. Can some one tell me what I'm doing wrong?
it looks like this:
var tbl=document.tbl;
var frm=document.frm;
var newcell=document.createElement("TD");
var newrow=document.createElement("TR");
var newfield=document.createElement("INPUT");
newfield.type="text";
newcell.appendChild(newfield);
newrow.appendChild(newcell);
tbl.appendChild(newrow);
frm.appendChild(newfield);
<form name="frm">
<table name="tbl">
</table>
</form>
Thanks,
-Amir.
I'm trying to add a row to a table with a form field in one
of it's cells, but if I'm appending the field to a form
it gets out of the table. Can some one tell me what I'm doing wrong?
it looks like this:
var tbl=document.tbl;
var frm=document.frm;
var newcell=document.createElement("TD");
var newrow=document.createElement("TR");
var newfield=document.createElement("INPUT");
newfield.type="text";
newcell.appendChild(newfield);
newrow.appendChild(newcell);
tbl.appendChild(newrow);
frm.appendChild(newfield);
<form name="frm">
<table name="tbl">
</table>
</form>
Thanks,
-Amir.