代码是这样的
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" onmouseout="this.style.backgroundColor='#ffffff'">
<tr onmouseover = "this.style.backgroundColor='red'">
onmouseover这个放在table上好用,但是整个表格都变色了,但是放在tr上就没有效果 这是为什么啊
因为你是给table对象这个onmouseover事件,,tr是他的子元素,,你给所有的tr赋给这个事件就可以了
没有问题,tr会变红,你的么变应该是td增加了其他样式,覆盖了tr的红色背景,tr和td背景色的分开的,td除非没有设置过背景色或者为transparent才会显示tr的背景色
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" onmouseout="this.style.backgroundColor='#ffffff'">
<tr onmouseover="this.style.backgroundColor='red'">
<td>11</td>
</tr></table>