1document.body.onclick = function (e) {
2 var isRightMB;
3 e = e || window.event;
4
5 if ("which" in e) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
6 isRightMB = e.which == 3;
7 else if ("button" in e) // IE, Opera
8 isRightMB = e.button == 2;
9
10 alert("Right mouse button " + (isRightMB ? "" : " was not") + "clicked!");
11}