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.οncοntextmenu=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){ |
△JS屏蔽鼠标右键:
1 | <script language= "JavaScript" > |
2 |
document.oncontextmenu= new Function( "event.returnValue=false;" ); |
3 |
document.onselectstart= new Function( "event.returnValue=false;" ); |
△jquery禁止右键弹出的突破方法:
如:
1 | $(document).bind( "contextmenu" , function () { return false ; }); |
6 | 地址栏中输入:javascript:alert($(document).unbind( "contextmenu" , "" )); |
△jquery 鼠标右键事件、左键单击事件判定:
2 | $( 'a' ).mousedown( function (e){ |
10 | $( '#downwps2010' ).mousedown( function (e){ |
14 | } else if (1 == e.which){ |