<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<table width="75%" border="1" ID="tableView">
  <tr onmouseover="changeRowColorOver(0)" onmouseout="changeRowColorOut(0)"  onclick="changeRowColorClick(0)" >
    <td>&nbsp;<input type="hidden" id="hidden0"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr onmouseover="changeRowColorOver(1)" onmouseout="changeRowColorOut(1)"  onclick="changeRowColorClick(1)" >
    <td>&nbsp;<input type="hidden" id="hidden1"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
   <tr onmouseover="changeRowColorOver(2)" onmouseout="changeRowColorOut(2)" onclick="changeRowColorClick(2)" >
    <td>&nbsp;<input type="hidden" id="hidden2"></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
<script>
function changeRowColorClick(intRow) //click
{
eval("document.all.hidden"+intRow+".value=1");
    //alert ("click"+intRow+document.all.tableView.rows(intRow).bgColor);
    document.all.tableView.rows(intRow).bgColor="11F0aa";    return true;
}
function changeRowColorOver(intRow)//over
{
if(eval("document.all.hidden"+intRow+".value")==1)
{
return ;
}    //alert ("over"+intRow+document.all.tableView.rows(intRow).bgColor);
    if (document.all.tableView.rows(intRow).bgColor!="11F0aa")
        document.all.tableView.rows(intRow).bgColor="11bbaa";
    else
        document.all.tableView.rows(intRow).bgColor="11F0aa";
    return true;
}
function changeRowColorOut(intRow)//out
{
if(eval("document.all.hidden"+intRow+".value")==1)
{
return ;
}    //alert ("out"+intRow+document.all.tableView.rows(intRow).bgColor);
             if (document.all.tableView.rows(intRow).bgColor!="11F0aa")
    document.all.tableView.rows(intRow).bgColor="f8f8f8";
    else
        document.all.tableView.rows(intRow).bgColor="11F0aa";
    return true;
}</script>
</html>

解决方案 »

  1.   

    主要是利用CSS属性...
    强!学习...
      

  2.   

    <TABLE>
    <TR onclick="mclick(this)" onmouseover='over(this)' onmouseout="out(this)"><TD>111</TD></TR>
    <TR onclick="mclick(this)" onmouseover='over(this)' onmouseout="out(this)"><TD>222</TD></TR>
    </TABLE>
    <SCRIPT LANGUAGE="JavaScript">
    function mclick(o){o.clicked=true; o.bgColor='green'}
    function over(o){if(!o.clicked) o.bgColor='red'}
    function out(o){if(!o.clicked) o.bgColor='blue'}
    </SCRIPT>
      

  3.   

    <html> 
    <head> 
    <title>Untitled Document</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    </head> 
    <body > 
    <table width="75%" border="1" ID="tableView"> 
      <tr onmouseover="changeRowColorOver(0)" onmouseout="changeRowColorOut(0)"  onclick="changeRowColorClick(0)" > 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
      </tr> 
      <tr onmouseover="changeRowColorOver(1)" onmouseout="changeRowColorOut(1)"  onclick="changeRowColorClick(1)" > 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
      </tr> 
       <tr onmouseover="changeRowColorOver(2)" onmouseout="changeRowColorOut(2)" onclick="changeRowColorClick(2)" > 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
      </tr> 
    </table> 
    </body> 
    <script> 
    function changeRowColorClick(intRow) //click 

        //alert ("click"+intRow+document.all.tableView.rows(intRow).bgColor); 
        document.all.tableView.rows(intRow).bgColor="11F0aa"; 
        document.all.tableView.rows(intRow).isClick = true;
        return true; 

    function changeRowColorOver(intRow)//over 

        //alert ("over"+intRow+document.all.tableView.rows(intRow).bgColor); 
        if (!document.all.tableView.rows(intRow).isClick)
            document.all.tableView.rows(intRow).bgColor="11bbaa"; 
        else 
            document.all.tableView.rows(intRow).bgColor="11F0aa"; 
        return true; 

    function changeRowColorOut(intRow)//out 

        //alert ("out"+intRow+document.all.tableView.rows(intRow).bgColor); 
        if (!document.all.tableView.rows(intRow).isClick) 
    document.all.tableView.rows(intRow).bgColor="f8f8f8"; 
        else 
            document.all.tableView.rows(intRow).bgColor="11F0aa"; 
        return true; 
    } </script> 
    </html>