Catch Left Or Right Button

[Total: 0    Average: 0/5]

Show which button was clicked.

Body Code:

<SCRIPT language=JavaScript>
function click() {
/* IE only */
if (event.button==1) 
alert('Left button was pressed !');
if (event.button==2) 
alert('Right button was pressed !');
}
document.onmousedown=click
</SCRIPT>
Press left or right button on mouse.

Times Viewed: 4

Leave a Reply

Your email address will not be published. Required fields are marked *