Mega Code Archive

 
Categories / JavaScript Reference / Javascript Properties
 

Button Example

<html> <body> <script language="JavaScript">     function function1() {         var m = window.event.button;         if (m == 1) {              alert("The left button has been pressed");          } else if (m == 2) {              alert("The right button has been pressed");          }     } </script> <div style="width:200;              height:200;              background-color:blue;"       onmousedown="function1();"> Press on mouse while on top of this blue box. </div> </body> </html>