示例如下:
复制代码代码如下:
<html>
<头>
<meta http-equiv =“ content-type” content =“ text/html; charset = gbk”>
<title>鼠标经过给tr换颜色</title>
</head>
<身体>
<table align =“中心” cellspacing =“ 1” cellpadding =“ 1”>
<tr style =“光标:手” onmousemove =“ changetcolor(this)”>
<td align =“中心”> 1 </td>
<TD> 123 </td>
<TD> ABVX </td>
<TD> 465465 </td>
<TD> 546654654 </td>
</tr>
<tr style =“光标:手” onmousemove =“ changetcolor(this)”>
<td align =“中心”> 1 </td>
<TD> 123 </td>
<TD> ABVX </td>
<TD> 465465 </td>
<TD> 546654654 </td>
</tr>
<tr style =“光标:手” onmousemove =“ changetcolor(this)”>
<td align =“中心”> 1 </td>
<TD> 123 </td>
<TD> ABVX </td>
<TD> 465465 </td>
<TD> 546654654 </td>
</tr>
</table>
<脚本类型=“ text/javascript”>
功能变频器(obj){
var _table = obj.parentnode;
for(var i = 0; i <_table.rows.length; i ++){
_table.Rows [i] .style.backgroundColor =“”;
}
obj.style.backgroundColor =“ blue”;
}
</script>
</form>
</body>
</html>