js中的鼠标右键点击事件
生活随笔
收集整理的这篇文章主要介绍了
js中的鼠标右键点击事件
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
https://www.cnblogs.com/sea-stream/p/9638870.html
window.onload = function(){//去掉默认的contextmenu事件,否则会和右键事件同时出现。document.oncontextmenu = function(e){e.preventDefault();};document.getElementById("test").onmousedown = function(e){if(e.button ==2){alert("你点了右键");}else if(e.button ==0){alert("你点了左键");}else if(e.button ==1){alert("你点了滚轮");}} }
转载于:https://www.cnblogs.com/150536FBB/p/11544314.html
总结
以上是生活随笔为你收集整理的js中的鼠标右键点击事件的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: C# 类构造函数赋值里属性与字段赋值注意
- 下一篇: 解决 -- 代码没有问题时接口报错:St