Mouse Event Test Page - Basic Version

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 old Level 0 DOM. There are also versions of this page that use the standard Level 2 addEventListener function. or with the IE attachEvent function.

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

Your browser ID: