定义一个样式表,然后在<td onmouseover=this.className='s1';>
s1为你定义的样式表

解决方案 »

  1.   

    <!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>
    <script language="javascript">
    function changecolor(obj,mousekind)
    {
    for(var i=0;i<obj.parentElement.parentElement.parentElement.rows.length;i++){
    obj.parentElement.parentElement.parentElement.rows[i].style.backgroundColor='';
    }
    var tdid=obj.parentElement; //取得所在tr
    //alert(tdid.tagName)
    if(mousekind == "over"){
    tdid.style.backgroundColor = "CornflowerBlue";
    }
    else{
    tdid.style.backgroundColor = "";
    }
    }
    </script>
    <table width="500" border="1">
      <tr>
        <td style="cursor:hand" onMouseOver="changecolor(this,'over')" onMouseOut="changecolor(this,'out')">&nbsp;</td>
      </tr>
      <tr>
        <td style="cursor:hand" onMouseOver="changecolor(this,'over')" onMouseOut="changecolor(this,'out')">&nbsp;</td>
      </tr>
      <tr>
        <td style="cursor:hand" onMouseOver="changecolor(this,'over')" onMouseOut="changecolor(this,'out')">&nbsp;</td>
      </tr>
    </table>
    </BODY>
    </HTML>
      

  2.   

    <td style="cursor:hand;" onMouseOver="this.bgColor='#ff0000';" onMouseOut="this.bgColor='';">测试一下</td>
      

  3.   

    <table width="170" height="72" border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td width="173" style="cursor: hand" onmouseover="this.bgColor='#FFFFF0'" onmouseout="this.bgColor=''">青岛嘉宏机械有限公司</td>
       </tr>
        <tr>
          <td style="cursor: hand" onmouseover="this.bgColor='#FFFFF0'" onmouseout="this.bgColor=''">青岛嘉宏国际货运有限公司</td>
       </tr>
        <tr>
          <td style="cursor: hand" onmouseover="this.bgColor='#FFFFF0'" onmouseout="this.bgColor=''">青岛嘉宏旅游度假山庄</td>
        </tr>
         <tr>
          <td style="cursor: hand" onmouseover="this.bgColor='#FFFFF0'" onmouseout="this.bgColor=''">香港捷丰投资有限公司</td>
        </tr>
       </table>
      

  4.   

    最简单的 <td onMouseOver="this.bgColor='#0066cc';" onMouseOut="this.bgColor='#ffffff';">fff</td>
      

  5.   

    <td onMouseOver="this.bgColor='#000000';" onMouseOut="this.bgColor='#ffffff';">黑变白</td>