禁止右键的代码:
$('body').bind('contextmenu', function() {return false;
});
禁止复制的代码:
$('body').bind("selectstart",function(){return false;});
鼠标事件:
$(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屏蔽鼠标右键:
<script language="JavaScript">document.οncοntextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
</script>
jquery 鼠标右键事件、左键单击事件判定:
$('#downwps2010').mousedown(function(e){if(3 == e.which){
alert('这 是右键单击<a href="http://www.qintag.com/tag/events" title="查看 事件 中的全部文章" target="_blank" class="tag_link">事件</a>');
}else if(1 == e.which){
alert('这 是左键单击<a href="http://www.qintag.com/tag/events" title="查看 事件 中的全部文章" target="_blank" class="tag_link">事件</a>');
}
})
破解页面不能右键 :
javascript:alert($(document).unbind("contextmenu",""));