<td onmouseover="this.style.backgroundColor='red'" onmouseout="this.style.backgroundColor='lightblue'">测试颜色<td>

解决方案 »

  1.   

    <td bgcolor="#CCCCCC" bgcolor1="#CCCCCC" bgcolor2="#ffffff" onMouseOut="this.bgColor=this.bgcolor1" onMouseOver="this.bgColor=this.bgcolor2">&nbsp;</td>
      

  2.   

    <td bgcolor="#CCCCCC" bgcolor2="#e0e0e0" onMouseOut="this.bgColor=this.bgColorBak" onMouseOver="this.bgColorBak=this.bgColor;this.bgColor=this.bgcolor2">&nbsp;</td>
      

  3.   

    thanks!
    不过我查了ref也没发现要用backgroundColor属性,td本来只发现有bgColor属性(但是用这个在上面的方法中没有用),后来又试过background-Color,提示javascript脚本错误。
    按照上面 smile908(working...) 所说的,换成backgroundColor就ok了。
    对了,你在哪儿查到有backgroundColor这个属性的?
      

  4.   

    backgroundColor是style的属性的脚本写法
    background-color是样式表写法如果在脚本里写作background-color那么浏览器会错误的理解为两个变量相减