码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-08-27 16:32:38      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   java   使用   io   ar   

 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>

 

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

标签:style   blog   http   color   os   java   使用   io   ar   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!