<script type="text/javascript">
window.onload = function(){
var y=document.getElementsByTagName("tr");
for (i=0;i<y.length;i++){
if(y[i].calssName!="active"){
y[i].onmouseover=function(){
this.style.backgroundColor="#f2f";
}
y[i].onmouseout=function(){
this.style.backgroundColor="#fff"
}
}
}
}
</script>
<body>
<table border="1" width="50%" id="table">
<tr>
<th>学号</th>
<th>姓名</th>
<th>操作</th>
</tr>
<tr>
<td class="active">xh001</td>
<td>王小明</td>
<td><a href="javascript:;" >删除</a></td>
</tr>
<tr>
<td>xh002</td>
<td>刘小芳</td>
<td><a href="javascript:;" >删除</a></td>
</tr>
</table>
<input type="button" value="添加一行" />
</body>