jQuery右键菜单

来源:互联网 发布:js createelement img 编辑:程序博客网 时间:2024/05/22 16:09
1.jquery屏蔽右键菜单的方法
(1)document.oncontextmenu = function(){return false;}
(2) $obj.bind("contextmenu",function(){   
        return false;   
    }); 
(3)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('这 是左键单击事件');
       
          }
      });
 2.jQuery右键菜单,参考http://sev7n.net/index.php/572.html#comments
原创粉丝点击