Hi
I have been trying to learn is much as I can about events in JavaScript. One of the sites I visited in this pursuit was "developer.mozilla.org". At that site I found the script below which is supposed to generate and an alert box telling you whether you click over the paragraph, included in the HTML, with the right mouse button or the left mouse button or the center mouse button. It only works on the left mouse button on my computer in both Internet Explorer and Firefox so please tell me why. I would appreciate it.

Sincerely
Marc

Link to the script I'm talking about

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Mouse which Button</title>
<script type="text/javascript">

function whichButton(e)
{
  // Handle different event models
  var e = e || window.event;
  var btnCode;

  if ('object' == typeof e){
    btnCode = e.button;

    switch (btnCode){
      case 0  : alert('Left button clicked');
                break;
      case 1  : alert('Middle button clicked');
                break;
      case 2  : alert('Right button clicked');
                break;
      default : alert('Unexpected code: ' + btnCode);
    }
  }
}

</script>		
</head>

<body>
<p onclick="whichButton(event);">Click with mouse...</p>
</body>
</html>