700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > javascript模拟鼠标双击事件

javascript模拟鼠标双击事件

时间:2018-10-22 17:58:44

相关推荐

javascript模拟鼠标双击事件

通常我们在做开发的时候需要通过单击切换对立事件,简单做了一个模型。

<!DOCTYPE html><html><head><title>javascript</title><meta charset="utf-8"><style type="text/css">#box{height: 200px;line-height: 200px;text-align: center;background: #eeeeee;}</style></head><body><div id="box">单击鼠标显示边框</div><script type="text/javascript">var box = document.getElementById('box');var flog = true;box.onclick = function(){if(flog){box.style.border = "3px solid #000000";box.innerHTML = "单击鼠标隐藏边框";flog = false;}else{box.style.border = "0px";box.innerHTML = "单击鼠标显示边框"flog = true;}}</script></body></html>

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