dom增加行

2016-02-22    编辑:Crese     点击(

<table border=1>
<tr id=a1>
<td><input></td><td><input></td>
</tr>
</table>
<input type=button name=ok onclick=add()>
<script language=javascript>
i=1
function add(){
var newTR = a1.cloneNode(true);
newTR.id="a"+(++i)
a1.parentNode.insertAdjacentElement("beforeEnd",newTR);
}
</script>