jQuery中没有内置的oncontextmenu事件处理程序,但是您可以执行以下操作:
$(document).ready(function(){ document.oncontextmenu = function() {return false;}; $(document).mousedown(function(e){ if( e.button == 2 ) { alert('Right mouse button!'); return false; } return true; }); });基本上,我取消了DOM元素的oncontextmenu事件以禁用浏览器上下文菜单,然后使用jQuery捕获mousedown事件,您可以在事件参数中知道按下了哪个按钮。



