I was struck by a recent question, where the% s of the left mouse button could in a specific case turn out to be right , and vice versa. p>
Code
var menulist = document.oncontextmenu;
var menu = function(ev) {
if (ev.button == 0 || ev.button == 1) {
menulist = new Function("return true;");
alert('Esquerdo');
} else {
if (ev.button == 2 || ev.button == 3) {
alert('Direito');
}
}
}
document.onclick = menu;
document.oncontextmenu = new Function("return false;");
What I really mean by this is set the right as the first to apply over a link that contains a file to download . Instead of firing a warning to the web surfer use the right button to Save Link As ... .
Ofcourse,itwouldbeidealjusttoplay%sofrightclickfortheleftbuttonwhenoverthelinkforwhichitwasspecified.Thentherightclick,losesitsactionatanygiventime.
Summary-"I want to know how to apply internal JavaScript behaviors to call
click
inoncontextmenu
."