日期:2014-05-16 浏览次数:20361 次
<html>
<head>
<script type="text/javascript">
function f1(){ //新增行
var i=0
var objrow = Mytable.insertRow(1);
for(i=0;i<4;i++){
var objcell = objrow.insertCell(i);
objcell.innerHTML = document.getElementById("td"+i).innerHTML;
}
}
function f2(){ //删除行 我只能实现一行一行的删除不能实现勾选哪行删除哪行
Mytable.deleteRow(1);
}
</script>
</head>
<body>
<table id="addButton1" name="x-btn">
<tr>
<td class="x-btn-center">
<button type="button" hidefocus="true" class="x-btn-text add" onclick="f1()">新增行</button>
</td>
</tr>
<tr>
<td class="x-btn-center">
<button type="button" hidefocus="true" class="x-btn-text delete" onclick="f2()" >删除行</button>
</td>
</tr>
</table>
<table id="Mytable" >
<thead>
<tr>
<th width="30px" align="center">
<div>选择</div></th>
<th align="center">
<div>行号</div></th>
<th align="center">
<div>本次退货数量</div></th>
<th align="center">
<div>本次退货数量</div></th>
</tr>
</thead>
<tbody id="tab1" style="display:">
<tr class="odd">
<td id="td0">
<input type="checkbox" name="checkbox1" value="1" id="checkid">
</td>
<td id="td1">
<input type="TEXT" />
</td>
<td id="td2">
<input type="TEXT" />
</td>
<td id="td3">
<input type="TEXT" />
</td>
</tr>
</tbody>
</table>
</body>