鼠标:禁用右键和中键单击 [英] mouse : disable right and middle button click

查看:338
本文介绍了鼠标:禁用右键和中键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用过了,但是没有用;萤火虫中没有错误:

I've used this but it doesn't work; no errors in the firebug:

$("div").live('mousedown', function(e) { 
   if( (e.which == 1) ) {
     return ;
   }if( (e.which == 3) ) {
     return false;
   }else if( (e.which == 2) ) {
      return false; 
   }
})

我可以使用contextmenu禁用右键单击,但是我不知道如何处理中间按钮.

I can disable right click with contextmenu but I dont know what to do about middle button.

推荐答案

您可以使用

<body oncontextmenu="return false">
...
</body>

为什么?因为它除了使用户烦恼之外什么也做不到.同样,许多浏览器都有一个安全选项,无论如何都不允许禁用右键单击(上下文)菜单.

Why? Because it achieves nothing other than annoying users. Also many browsers have a security option to disallow disabling of the right click (context) menu anyway.

不确定为什么要这么做.如果出于某种误以为您可以用这种方式保护源代码或图像的想法,请再三考虑:您不能.

Not sure why you'd want to. If it's out of some misplaced belief that you can protect your source code or images that way, think again: you can't.

这篇关于鼠标:禁用右键和中键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆