-3
可能重複:
How to distinguish between left and right mouse click with jQuery?如何激活jquery的右鍵點擊?
在右鍵點擊我想要去一個不同的page..using jQuery的,那怎麼辦?任何想法?
thanks-
可能重複:
How to distinguish between left and right mouse click with jQuery?如何激活jquery的右鍵點擊?
在右鍵點擊我想要去一個不同的page..using jQuery的,那怎麼辦?任何想法?
thanks-
事情是這樣的:
HTML
<a id="test" href=#">Click me</a>
JQuery的
$(document).ready(function() {
$("#test").mousedown(function(e) {
switch (e.which) {
case 1:
alert("Left click... boring!");
break;
case 3:
alert("Right-click... off to new page...");
window.top.location = "http://www.google.com/";
break;
}
})
});
的jsfiddle here
你想惹惱你的用戶S' – ThiefMaster