Mouse Event Test Page - attachEvent Version

Note: This page will only work in Internet Explorer. Use this version for other browsers.

click here to test
click here to clear

This page contains a script for testing the events fired in different browsers when a mouse click occurs. Click on the "click here to test" link to see the events fired by the click.

This script will capture and log the following event types:

  • mousedown - the mouse button goes down.
  • mouseup - the mouse button goes up.
  • click - a logical mouse click.
  • dblclick - a logical mouse double click has occured.
  • contextmenu - a context menu has been triggered.
We do not consider mouseover, mouseoff or mousemove events here.

Different browsers generate different events in different orders. For each event, the script will give the values of the event.which and event.button variables, which indicate which mouse button was clicked.

Try left clicks, right clicks, and middle clicks. Try double clicks.

Every attempt has been made to disable the default actions of mouse clicks when clicking on the test link. However, in some browsers, the defaults cannot be disabled, so various strange side effects may occur.

In a correctly working browser, only clicks on the link should be logged in the window, and default actions should still occur if the same mouse buttons are clicked on other parts of the screen. Not all browsers work correctly.

This page sets up event handlers with the Microsoft's old attachEvent function to set up the event handlers. This is not standard and not supported by other browsers. For those, use the alternate versions of this page, which use the basic Level 0 event handlers or the standard Level 2 addEventListener function.

See for a summary of results of tests of mouse events on different browsers.

Your browser ID: