<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; color:white;" onmousedown="function1();"> Press on mouse while on top of this blue box. </div> </body> </html>
Related Scripts with Example Source Code in same category :