<tr onmouseover="this.bgcolor='#eeeeee'" onmouseout="this.bgcolor='#ffffff'">

解决方案 »

  1.   

    怪事?
    你把OUT事件的那個顏色不設或者設成TABLE的背景色就可以的啦!還是我沒有理解對呢?
      

  2.   

    <table border="1" width="100%">
      <tr bgcolor=cccccc onmouseover="this.style.backgroundColor='red';" onmouseout="this.style.backgroundColor='';" >
        <td >a1</td>
        <td >b1</td>
      </tr>
      <tr bgcolor=dddddd onmouseover="this.style.backgroundColor='red';" onmouseout="this.style.backgroundColor='';" >
        <td >a2</td>
        <td >b2</td>
      </tr>
    </table>原因见以下:css的优选级问题:
    <head>
    <style>
    .widthTest
    {
    width:200;
    }
    </style></head>一些小知识(JK):
    <hr>
    01.
    width的优先级别(许多其它的样式也有类似的优先问题):<br/>
    <input id=widthTestObj > <br/>
    style="width:300" <input type=checkBox onclick="if(this.checked) widthTestObj.style.width=300; else widthTestObj.style.width=null;"> <br/>
    class=widthTest <input type=checkBox onclick="if(this.checked) widthTestObj.className='widthTest'; else widthTestObj.className=null;"> <br/>
    width=100 <input type=checkBox onclick="if(this.checked) widthTestObj.width=100; else widthTestObj.removeAttribute('width');"> <br/>
    <hr>
      

  3.   

    定义三个样式:
    tr0:偶数行的样式
    tr1:奇数行的样式
    trOver:鼠标移动的样式<tr class="tr0" onmouseover="doMouseOver(this);" onmouseout="doMouseOut(this);">
    <tr class="tr1" onmouseover="doMouseOver(this);" onmouseout="doMouseOut(this);">
    function doMouseOver(tr){
        tr.className="trOver";
    }
    function doMouseOut(tr){
        tr.className="tr"+(tr.rowIndex%2);
    }