700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > JS:鼠标移入移出事件监听

JS:鼠标移入移出事件监听

时间:2020-10-24 16:04:42

相关推荐

JS:鼠标移入移出事件监听

<!DOCTYPE html><html lang="en" dir="ltr"><head><meta charset="utf-8"><title>鼠标移入移出显示效果</title><style>#div1 {width: 150px;height:50px;background: #fffccc;border:1px solid #999;display: none;}#div2{width: 200px;height:200px;background: red;}</style></head><body><input type="checkbox" onmouseover="document.getElementById('div1').style.display='block';"onmouseout="document.getElementById('div1').style.display='none';"><div id="div2" onmousemove="over()" onmouseout="out()"></div></body><script type="text/javascript">function over(){var obj=document.getElementById("div2");obj.style.width="400px";obj.style.height="400px";obj.style.background="green";}function out(){var obj=document.getElementById("div2");obj.style.width="200px";obj.style.height="200px";obj.style.background="red";}</script></html>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。