Event Object
The button event attribute returns a number that indicates which mouse button was clicked when an event was triggered.
| Parameter | Description |
|---|---|
| 0 | Specifies the left mouse-button |
| 1 | Specifies the middle mouse-button |
| 2 | Specifies the right mouse-button |
Note: Internet Explorer 8 and earlier has different parameters:
| Parameter | Description |
|---|---|
| 1 | Specifies the left mouse-button (IE8 and earlier) |
| 4 | Specifies the middle mouse-button (IE8 and earlier) |
| 2 | Specifies the right mouse-button |
Note: For a left-hand configured mouse, the parameter values are reversed.
Alert which mouse button that was pressed
Alert which mouse button the user pressed.
Event Object
Your message has been sent to W3Schools.