Check Which Mouse Button is clicked in IE Using java Script

Chikul
Posted by Chikul under JavaScript category on | Views : 2733
   <script type="text/javascript" >
document.onmousedown=fnMouseButton

function fnMouseButton()
{
alert(event.button);
switch (event.button)
{
case 1 :
alert('Left button clicked');
break;
case 4 :
alert('Middle button clicked');
break;
case 2 :
alert('Right button clicked');
break;
default :
alert('Unexpected code: ' + btnCode);
}
}

</script>

Comments or Responses

Login to post response