<table width=100% bgcolor=cccccc onmouseout="select_row(null)">
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
</table>
<script language="javascript">
var theCurrentTr;
function select_row(obj)
{
if(theCurrentTr!=null) theCurrentTr.bgColor="";
theCurrentTr=obj;
if(theCurrentTr!=null) theCurrentTr.bgColor="blue";
}
</script>
<br>
<br>
移出时还记录最后鼠标所在的行:
<table width=100% bgcolor=cccccc>
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
<tr id="row0" onmouseover="select_row(this)">
<td>
...
</td>
</tr>
</table>