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

jQuery屏蔽鼠标右键:

1$(document).ready(function(){

2    $(document).bind("contextmenu",function(e){

3          return false;

4    });

5});

△JS屏蔽鼠标右键:

1<script language="JavaScript">

2     document.oncontextmenu=new Function("event.returnValue=false;");

3     document.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})

整理自互联网:http://shenlm203.iteye.com/blog/796609

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注