MouseEvent button property
Definition and Usage
The button property returns a number indicating which mouse button was pressed when the mouse event was triggered.
This property is mainly used with the onmousedown event.
Note:This property is read-only.
Example
Find out which mouse button was pressed when the mouse event was triggered:
alert("You pressed button: " + event.button)
Syntax
event.button
Technical Details
Return values: |
Numeric values representing the mouse button pressed when the mouse event occurs. Possible values:
Note:Internet Explorer 8 and earlier versions have different return values:
Note:For left-handed mouse configuration, the return value is reversed. |
---|---|
DOM Version: | DOM Level 2 Events |
Mwamadharani wa kifungu
Inaonekana kwenye tabia ya kina ya tabia inaonekana kwenye kina cha kwanza cha kusimamia tabia hii.
Mafano ya mafano | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
button | Mwamadharani | Mwamadharani | Mwamadharani | Mwamadharani | 8.0 |
Vipindi vya vingine
Makala ya HTML DOM ya DOM:属性 ya MouseEvent buttons
Makala ya HTML DOM ya DOM:属性 ya MouseEvent which