<tr onmouseover="this.style.backgroundColor='red'" onmouseout="this.style.backgroundColor=''">

解决方案 »

  1.   

    <table width=200>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td>a</td>
    <td>a</td>
    <td>a</td>
    </tr>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td>b</td>
    <td>b</td>
    <td>b</td>
    </tr>
    </table>
    <script language="JavaScript">
    <!--
    function over(o){
    o.style.backgroundColor='red'
    if(event.srcElement.tagName=="TD")event.srcElement.style.backgroundColor='blue'
    }
    function out(o){
    o.style.backgroundColor=''
    if(event.srcElement.tagName=="TD")event.srcElement.style.backgroundColor=''
    }
    //-->
    </script>
      

  2.   

    行了,不过有点麻烦。
     <table width=200>
    <tr id=di1>
    <td id=di2>a</td>
    <td id=di3>a</td>
    <td>a</td>
    <td onmouseover="over(this)" onmouseout="out(this)">b</td>
    <td>b</td>
    <td>b</td>
    </tr>
    </table>
    <script language="JavaScript">
    <!--
    function over(o){
    o1.style.backgroundColor='red'
    o2.style.backgroundColor='red'
    o3.style.backgroundColor='red'
    if(event.srcElement.tagName=="TD")event.srcElement.style.backgroundColor='blue'
    }
    function out(o){
    o1.style.backgroundColor=''
    o2.style.backgroundColor=''
    o3.style.backgroundColor=''
    if(event.srcElement.tagName=="TD")event.srcElement.style.backgroundColor=''
    }
    //-->
    </script> 还有其它方法吗?