动态增加删除一行
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>hdfs metrics</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script type="text/javascript" src="js/jquery-3.0.0/jquery-3.0.0.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
function InserTab() {
var rowT = "<tr><td style='text-align: right;'><button οnclick='deleteRow(this)'>删除</button></td></tr>";
$("#tab").append(rowT);
}
function deleteRow(r)
{
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('tab').deleteRow(i);
}
</script>
</head>
<body>
<div id="contents" class="body" style="color: black">
<table id="tab" width="100%" style="border: thick;">
</table>
<table width="100%" style="border: none;">
<tr>
<td style="text-align: right;">
<button type="button" οnclick="InserTab()">添加</button>
</td>
</tr>
</table>
</div>
</body>
</html>