[b][color=blue]javascript使用DOM动态删除表格中的一行,赶快复制到本地试试吧[/color][/b]
<html>
<head>
<script type="text/javascript">
function deleteRow(r)
{
var i=r.parentNode.parentNode.rowIndex
document.getElementById('myTable').deleteRow(i)
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>Row 1</td>
<td><a href="#" onclick="deleteRow(this)">del</a></td>
</tr>
<tr>
<td>Row 2</td>
<td><input type="button" value="delte" onclick="deleteRow(this)"></td>
</tr>
<tr>
<td>Row 3</td>
<td><input type="button" value="delete" onclick="deleteRow(this)"></td>
</tr>
</table></body>
</html>