MouseEvent.button (Property)

The mouse button that was pressed to trigger the event.


DOM level - 2
JavaScript - 1.5
Netscape - 6.0
Property/method value type:Number primitive
JavaScript syntax:NmyMouseEvent.button

If you need to determine which mouse button was pressed to trigger the event, this property will contain a value to indicate the button.

Note that on a Macintosh, this value is meaningless as there is only one button on a an Apple Macintosh mouse.

Third party mice can be added to Apple Macintosh systems to provide multiple (2 or 3) button functionality but they are by no means commonplace and it is probably safe to assume only a 1 button mouse on the Macintosh platform.

The values for the buttons are defined to cope with 1, 2 or 3 button mice.

The following values correspond with mouse buttons:

See also:Event.button, Event.which

Property attributes: