<div id=div1 onMouseover="div1.bgColor='lightblue';" onMouseOut="div1.bgColor='transparent';">

解决方案 »

  1.   

    <html>
    <body>
    <div onMouseover="document.all.table1.bgColor='lightblue';" onMouseOut="document.all.table1.bgColor='transparent';">
    <table tabindex="-1" width="100%" id="table1"  >
    <tr>
    <td >Hello</td>
    </tr>
    </table>
    </body>
    </html>
      

  2.   

    <div id=div1 onMouseover="div1.bgColor='lightblue';" onMouseOut="div1.bgColor='transparent';">行不通呀,如何改变div的颜色呢?
      

  3.   

    <Table onMouseOver="this.style.backgroundColor='#444444'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
    <tr>
    <td>aaaasdasd</td>
    <td>asdasdasd</td>
    </tr>
    <tr>
    <td>asdasdas</td>
    <td>asdasdasda</td>
    </tr>
    </Table>
      

  4.   

    <Table onMouseOver="this.style.backgroundColor='#444444'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
    <tr>
    <td>aaaasdasd</td>
    <td>asdasdasd</td>
    </tr>
    <tr>
    <td>asdasdas</td>
    <td>asdasdasda</td>
    </tr>
    </Table>
      

  5.   

    <Table onMouseOver="this.style.backgroundColor='#444444'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
    <tr>
    <td>aaaasdasd</td>
    <td>asdasdasd</td>
    </tr>
    <tr>
    <td>asdasdas</td>
    <td>asdasdasda</td>
    </tr>
    </Table>
      

  6.   

    直接利用
    <div style="width:120px;height:30px;background-color:'#FF0000'" onMouseOver="this.style.backgroundColor='#0000FF'" onMouseOut="this.style.backgroundColor='#FF0000'"></div>来实现
    如果想在整个页面多个元素实现 , 除了用htc外, 还可以用下面方法:<script>
    function ChangeColor(obj , color)

        obj.style.backgroundColor = color ;
    }
    </script>
    <div style="width:120px;height:30px;background-color:'#FF0000'" onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FF0000');"></div>
    <table width="300px" border="1">
    <tr>
      <td onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FFFFFF');">aaaaaa</td>
      <td onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FFFFFF');">bbbbbb</td>
    </tr>
    <tr>
      <td onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FFFFFF');">cccccc</td>
      <td onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FFFFFF');">dddddd</td>
    </tr>
    </table>
    利用ChangeColor函数 , 就可以将整个页面想要实现效果的地方 ,用onMouseOver="ChangeColor(this,'#0000FF');" onMouseOut="ChangeColor(this,'#FFFFFF');"就可以了。。很方便的。