onmouseover()与onmouserout()事件控制
使用CSS,或者直接就是控制Bgcolor

解决方案 »

  1.   

    <table>
    <tr onmouseover="this.style.backgroundColor='ff0000'" onmouseout="this.style.backgroundColor='ffffff'"><td>ab</td></tr>
    <tr onmouseover="this.style.backgroundColor='ff0000'" onmouseout="this.style.backgroundColor='ffffff'"><td>bc</td></tr>
      

  2.   

    <table border=1>
    <tr onmouseover='bgColor="#ffcc00";' onmouseout='bgColor="";'><td>11</td><td>12</td></tr>
    <tr onmouseover='bgColor="#ffcc00";' onmouseout='bgColor="";'><td>21</td><td>22</td></tr>
    </table>
      

  3.   

    移出时不记录最后鼠标所在的行:
    <table width=100% bgcolor=cccccc onmouseout="select_row(null)">
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    </table>
    <script language="javascript">
    var theCurrentTr;
    function select_row(obj)
    {
    if(theCurrentTr!=null) theCurrentTr.bgColor="";
    theCurrentTr=obj;
    if(theCurrentTr!=null) theCurrentTr.bgColor="blue";}
    </script><br>
    <br>
    移出时还记录最后鼠标所在的行:
    <table width=100% bgcolor=cccccc>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    <tr id="row0" onmouseover="select_row(this)"><td>...</td></tr>
    </table>