在网页上显示报表或列表时会查看一行,如果暂时更改这一行的背景颜色,就能使用户更方便查看数据,增强用户体验。 现给出代码,比较简单哈,不做说明了: 方法一 <script language="javascript">
function ChangNewColor(obj){
obj.style.backgroundColor = "#00ff00"
}
function ChangOldColor(obj){
obj.style.backgroundColor="";
}
</script>
<table width="100%%" border="1" cellspacing="1" cellpadding="1" bgcolor="#00ff00">
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
<tr onmouseout="ChangNewColor(this)" onmouseover="ChangOldColor(this)" >
<td> </td>
<td> </td>
</tr>
</table>
方法二 <tr onmouseover=\"this.style.backgroundColor='#999999'\" onmouseout=\"this.style.backgroundColor=''\">
|