<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>删除表格</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
var rount=0;
function deleteRow(){
var mytable = document.getElementsByTagName("table")[0];
for(var i=mytable.rows.length-1;i>=0;i--){
if(mytable.rows(i).cells(0).firstChild.checked){
mytable.rows(i).removeNode(true);
}
}
}
</script>
<body>
<center>
<br/>
删除表格测试
<hr/>
<br/>
<table border="1" width="480">
<tr>
<td><input type=checkbox></td >
<td>11111</td>
</tr>
<td><input type=checkbox></td>
<td>22222</td>
</tr>
<td><input type=checkbox></td>
<td>33333</td>
</tr>
<td><input type=checkbox></td>
<td>44444</td>
</tr>
<td><input type=checkbox></td>
<td>55555</td>
</tr>
</table>
</center>
<input type=button value="删除" onclick=deleteRow()>
</BODY>
</HTML>
删除行(table操作)
最新推荐文章于 2022-12-21 11:14:18 发布