http://blog.qintag.com/right-jquery-event-left-click-the-event-to-determine.html
jQuery屏蔽鼠标右键:
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
returnfalse;
});
});
JS屏蔽鼠标右键:
<scriptlanguage="JavaScript">
document.oncontextmenu=newFunction("event.returnValue=false;");
document.onselectstart=newFunction("event.returnValue=false;");
</script>
jquery禁止右键弹出的突破方法:
$(document).bind("contextmenu",function(){returnfalse;});//这段JS代码将禁止右键弹出</pre>
<!--more-->
<pre>
突破方法:
地址栏中输入:javascript:alert($(document).unbind("contextmenu",""));
jquery鼠标右键事件、左键单击事件判定:
$(function(){
$('a').mousedown(function(e){
alert(e.which)//1=鼠标左键left;2=鼠标中键;3=鼠标右键
returnfalse;//阻止链接跳转
})
})
如
$('#downwps2010').mousedown(function(e){
if(3==e.which){
alert('这是右键单击事件');
}elseif(1==e.which){
alert('这是左键单击事件');
}
})
jquery鼠标右键事件、左键单击事件判定
$(function(){
$('a').mousedown(function(e){
alert(e.which)//1=鼠标左键left;2=鼠标中键;3=鼠标右键
returnfalse;//阻止链接跳转
})
})
如
$('#downwps2010').mousedown(function(e){
if(3==e.which){
alert('这是右键单击事件');
}elseif(1==e.which){
alert('这是左键单击事件');
}
})
用js,jQuery屏蔽鼠标右与jquery鼠标右键事件、左键单击事件判定
-△jQuery屏蔽鼠标右键:
[code]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 ;}); //这段JS代码将禁止右键弹出</pre> |
6 | 地址栏中输入:javascript:alert($(document).unbind( "contextmenu" , "" )); |
△jquery鼠标右键事件、左键单击事件判定:
2 | $( 'a' ).mousedown( function (e){ |
3 | alert(e.which) // 1=鼠标左键left;2=鼠标中键;3=鼠标右键 |
10 | $( '#downwps2010' ).mousedown( function (e){ |
[/code]
-
-