鼠标划过时整行变色代码
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
[html] view plaincopy
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function overIt(){
var the_obj = event.srcElement;
if(the_obj.tagName.toLowerCase() == "td"){
the_obj=the_obj.parentElement;
the_obj.oBgc=the_obj.currentStyle.backgroundColor;
the_obj.oFc=the_obj.currentStyle.color;
the_obj.style.backgroundColor='#71BAF0';
the_obj.style.color='';
}
}
function outIt(){
var the_obj = event.srcElement;
if(the_obj.tagName.toLowerCase() == "td"){
the_obj=the_obj.parentElement;
the_obj.style.backgroundColor=the_obj.oBgc;
the_obj.style.color=the_obj.oFc;
the_obj.style.textDecoration='';
}
}
</script>
</head>
<body>
<table border=1 width=400 onmouseover="overIt()" onmouseout="outIt()">
<tr bgColor=#111111>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
</tr>
<tr bgColor=#222222>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
</tr>
<tr bgColor=#333333>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
</tr>
<tr bgColor=#444444>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td></tr>
<tr bgColor=#555555>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
<td>aaa</td>
</tr>
</table>
</body>
</html>
补充:web前端 , JavaScript ,