js控制鼠標(biāo)事件移動(dòng)及移出效果顯示

字號(hào):


    鼠標(biāo)事件的移動(dòng)及移出效果都可以使用js來自定義,下面有個(gè)示例,效果為當(dāng)事件發(fā)生改變時(shí)背景顏色也隨著改變,適合新手朋友
    <style type="text/css">
    .style0{
    background-color:#FFFF00;
    }
    .style1{
    background-color:#00FFFF;
    }
    </style>
    </head>
    <body>
    <table width="576" height="79">
    <tr>
    <td id="td1" onmousemove="document.getElementById('td1').className='style0';" onmouseout="document.getElementById('td1').className='style1'"><div>主頁</div></td>
    <td><div>男</div></td>
    <td><div>女</div></td>
    </tr>
    </table>
    </body>