急!鼠标经过表格可以不整行换色么?

来源:百度知道 编辑:UC知道 时间:2024/05/12 09:29:13
onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
这段代码是鼠标经过表格背景变色的代码。大家应该都知道

可是现在需要的是,鼠标经过表格背景变色,但是不是整行都变色,一行8列,指向2列,2列的变色。

谁有什么方法可以实现么?如果有什么实例的链接最好。谢谢各位了。
写到tr里不是整行都变色了,但是是一列变色啊,我想实现的是2列一起变色,你没看到图片,单位,电话是一起的么,一行2列的变色。

你原来的事件是加在tr上的,改成td上就可以了,示例如下

<table border="1">
<tr>
<td onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
>100</td>
<td onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
>200</td>
<td onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
>300</td>
</tr>
<tr>
<td onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
>400</td>
<td onMouseOver="this.style.backgroundColor='#EAEAEA'"onMouseOut="this.style.backgroundColor=''"
>500</td>
<td onMouseOver="this.style.backgro