首页 > Web开发 > 详细

html屏蔽鼠标右键

时间:2016-01-08 20:25:12      阅读:229      评论:0      收藏:0      [点我收藏+]
 1 <!doctype html>
 2 <html lang="en">
 3  <head>
 4   <meta charset="UTF-8">
 5   <meta name="Generator" content="EditPlus®">
 6   <meta name="Author" content="">
 7   <meta name="Keywords" content="">
 8   <meta name="Description" content="">
 9   <title>Document</title>
10  </head>
11  <body>
12     <script type="text/javascript">
13         document.oncontextmenu = function() {
14              return false;
15         }
16         
17          //  左键是1 滑轮是2 右键是3
18         document.addEventListener("mousedown",function(e){
19             alert(e.which);
20         },false);
21         
22         // jquery 方式
23         $(document).mousedown(function(e){
24             var key = e.which;
25             if(key == 3){
26                 alert("这个事鼠标右键");
27             }else{
28                 alert(key);
29             }
30         });
31     </script>
32  </body>
33 </html>

 

html屏蔽鼠标右键

原文:http://www.cnblogs.com/zfy0098/p/5114283.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!