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

 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>

 

posted @ 2014-08-27 15:41  核动力脚本  阅读(248)  评论(0)    收藏  举报