Home  >  Article  >  Web Front-end  >  js控制鼠标事件移动及移出效果显示_javascript技巧

js控制鼠标事件移动及移出效果显示_javascript技巧

WBOY
WBOYOriginal
2016-05-16 16:33:301607browse

鼠标事件的移动及移出效果都可以使用js来自定义,下面有个示例,效果为当事件发生改变时背景颜色也随着改变,适合新手朋友

<style type="text/css">
.style0{
background-color:#FFFF00;
}
.style1{
background-color:#00FFFF;
}
</style>
</head>


<body>
<table width="576" height="79" border="1">
<tr>
<td id="td1" onmousemove="document.getElementById('td1').className='style0';" onmouseout="document.getElementById('td1').className='style1'"><div align="center" class="STYLE2">主页</div></td>
<td><div align="center" class="STYLE2">男</div></td>
<td><div align="center" class="STYLE2">女</div></td>
</tr>
</table>
</body> 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn