用js,jQuery屏蔽鼠标右与jquery 鼠标右键事件、左键单击事件判定

来源:互联网 发布:单片机setb 编辑:程序博客网 时间:2024/05/16 18:34
http://blog.qintag.com/right-jquery-event-left-click-the-event-to-determine.html
 
 
jQuery屏蔽鼠标右键:
 
$(document).ready(function(){    $(document).bind("contextmenu",function(e){          return false;    });});
 
JS屏蔽鼠标右键:
<script language="JavaScript">     document.oncontextmenu=new Function("event.returnValue=false;");     document.onselectstart=new Function("event.returnValue=false;");</script>

jquery禁止右键弹出的突破方法:
$(document).bind("contextmenu", function() { return false; });  //这段JS代码将禁止右键弹出</pre><!--more--><pre>突破方法:地址栏中输入:javascript:alert($(document).unbind("contextmenu",""));

jquery 鼠标右键事件、左键单击事件判定:
$(function(){$('a').mousedown(function(e){alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键return false;//阻止链接跳转})})如$('#downwps2010').mousedown(function(e){if(3 == e.which){alert('这 是右键单击事件');}else if(1 == e.which){alert('这 是左键单击事件');}}) 

jquery 鼠标右键事件、左键单击事件判定
$(function(){ $('a').mousedown(function(e){ alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键 return false;//阻止链接跳转 }) }) 如 $('#downwps2010').mousedown(function(e){           if(3 == e.which){                alert('这 是右键单击事件');                      }else if(1 == e.which){                    alert('这 是左键单击事件');                       }         })
 
 
 
 
 
 
 
 

用js,jQuery屏蔽鼠标右与jquery 鼠标右键事件、左键单击事件判定

 

-

△jQuery屏蔽鼠标右键:

 

1$(document).ready(function(){
2$(document).bind("contextmenu",function(e){
3return false;
4});
5});

△JS屏蔽鼠标右键:

 

1<script language="JavaScript">
2document.oncontextmenu=new Function("event.returnValue=false;");
3document.onselectstart=new Function("event.returnValue=false;");
4</script>

△jquery禁止右键弹出的突破方法:

如:

1$(document).bind("contextmenu", function() { return false; }); //这段JS代码将禁止右键弹出</pre>
2<!--more-->
3<pre>
4 
5突破方法:
6地址栏中输入:javascript:alert($(document).unbind("contextmenu",""));

△jquery 鼠标右键事件、左键单击事件判定:

 

1$(function(){
2$('a').mousedown(function(e){
3alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
4return false;//阻止链接跳转
5})
6})
7 
8
9 
10$('#downwps2010').mousedown(function(e){
11if(3 == e.which){
12alert('这 是右键单击事件');
13 
14}else if(1 == e.which){
15alert('这 是左键单击事件');
16 
17}
18})

 

-
 
 

 

 

 

-
	
				
		
原创粉丝点击