<div onmouseover="this.className='ahover'" onmouseout="this.className='list'" class="list" id="subject"></div>
利用了onmouseover与onmouseout,鼠标进入与鼠标离开两个事件

解决方案 »

  1.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <title>Rank's HTML document</title>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <meta http-equiv="Pragma" content="no-cache" />  
        <meta http-equiv="Cache-Control" content="no-cache" />     
        <meta http-equiv="Expires" content="0" />
        <meta http-equiv="ImageToolbar" content="no" />
        <style type="text/css" title="default" media="screen">
        /*<![CDATA[*/
          .out { padding:0;background:transparent; }
          .over { padding:10px;background:#eee; }
        /*]]>*/
        </style>
        </head>
      <body id="www.never-online.net">
        <table cellpadding="0" cellspacing="0" width="100%" border="1">
        <tr>
          <td>www.never-online.net</td>
          <td>www.never-online.net</td>
        </tr>
        <tr>
          <td>www.never-online.net</td>
          <td>www.never-online.net</td>
        </tr>
        <tr>
          <td>www.never-online.net</td>
          <td>www.never-online.net</td>
        </tr>
        </table>
        <script type="text/javascript">//<![CDATA[
          var a = document.getElementsByTagName('tr');
          var i=a.length;while (i--) { 
          a[i].onmouseover=function(){this.className='over';}
          a[i].onmouseout=function(){this.className='out';}
          }
        //]]></script>
      </body>
    </html>