情况如图。
下面是代码。
<html>
<head>
<script type="text/javascript" src="jquery-1.9.1/jquery.js"></script>
<style type="text/css">
th,td{
border: 1px solid grey;
}
</style>
<meta charset="utf-8">
</head>
<body>
<table>
<tr>
<th>学号</th>
<th>姓名</th>
<th>操作</th>
</tr>
<tr>
<td>xh001</td>
<td>詹三</td>
<td><a href="">删除</a></td>
</tr>
<tr>
<td>xh002</td>
<td>李三</td>
<td><a href="">删除</a></td>
</tr>
<tr>
<td><a href="">新增</a>
</tr>
</table>
<script type="text/javascript">
var addnew=$("tr:contains('新增')");
var table1=$("table");
var num=3;
$("tr").hover(function(){
$(this).css("background-color","grey")
},
function(){
$(this).css("background-color","white")
}
)
addnew.bind("click",a1);
function a1(){
num++;
var newtr="<tr><td></td><td>name</td><td><a>删除</a></td></tr>";
$(addnew).before(newtr);
}
</script>
</body>
</html>
七古龙东墙
_nbsp
_nbsp
qq_冲哥_0
Sprash