event Properties DHTML Events
DOM Level 2 Specification.
Retrieves which mouse button, if any, is pressed.
HTML |
N/A |
Script |
[ sWhichButton = ] event.button |
0 |
No button is pressed. |
1 |
Left button is pressed. |
2 |
Right button is pressed. |
3 |
Both left and right buttons are pressed. |
4 |
Middle button is pressed. |
5 |
Both left and middle buttons are pressed. |
6 |
Both right and middle buttons are pressed. |
7 |
All three buttons are pressed. |
The property is read-only with a default value of 0.
During mouse events caused by the depression or release of a mouse button, button is used to indicate which mouse button changed state. For mice configured for left handed use in which the button actions are reversed, the values are instead read from right to left.
This property is intended to be used with the onmousedown, onmouseup, and onmousemove events. For other events, it defaults to 0 regardless of the state of the mouse buttons.
event