先做一个css
然后修改td的.className的值

解决方案 »

  1.   

    onmouseover="this.bgcolor=red"
    onmouseout = "this.bgcolor=orange";
      

  2.   

    给TR元素 也就是表格行元素加个 鼠标移上和鼠标移出的事件 在事件里面改变行的背景色<table>
    <tr onmouseover="this.style.background='#DDDDDD'" onmouseout = "this.style.background=''">......</tr>
    </table>
      

  3.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head><body>
      
      <table   width=100%   style="border-collapse:collapse;   table-layout:fixed"   border >  
      <tr onmouseover="this.style.background='#DDDDDD'" onmouseout="this.style.background='blue'">  
        <td   width=20% >&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      <tr onmouseover="this.style.background='#DDDDDD'" onmouseout="this.style.background='blue'">  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      <tr onmouseover="this.style.background='#DDDDDD'" onmouseout="this.style.background='blue'">  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      <tr onmouseover="this.style.background='#DDDDDD'" onmouseout="this.style.background='blue'">  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      <tr onmouseover="this.style.background='#DDDDDD'" onmouseout="this.style.background='blue'">  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      <tr>  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>  
      </table>   
    </body>
    </html>
      

  4.   

    自己分别给onmouseover\onmouseout写一个方法,参数就是tr的实例,
    function mouseover(obj)
    {
        obj.bgcolor=red;
    }
    使用时
    <tr onmouseover="mouseover('#DDDDDD');" >  
        <td   width=20%>&nbsp;</td><td>&nbsp;</td>  
      </tr>
    这样就好一些,注意代码的简单化