首页 > 其他 > 详细

禁止使用鼠标左右键(跨浏览器实现)

时间:2014-08-27 16:32:38      阅读:235      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 2 <html>
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 5 <title>机制使用鼠标左右键</title>
 6 </head>
 7 <body>
 8 <script type="text/javascript">
 9 function click(){
10     if(navigator.appName=="Netscape" && event.button==0){
11         alert("禁止使用鼠标左键");
12     }
13     
14     if(navigator.appName=="Microsoft Internet Explorer" && event.button==1){
15         alert("禁止使用鼠标左键");
16     }
17     
18     if(navigator.appName=="Opera" && event.button==0){
19         alert("禁止使用鼠标左键");
20     }
21     
22     if(event.button==2){
23         alert("禁止使用鼠标右键");
24     }
25 }
26 document.onmousedown=click;
27 </script>
28 </body>
29 </html>

 

禁止使用鼠标左右键(跨浏览器实现)

原文:http://www.cnblogs.com/pinsige/p/3939626.html

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