The buttons
property returns which mouse buttons are pressed when a mouse event occurs.
The buttons
property is mostly used with the onmousedown
event.
The buttons
property is read-only.
event.buttons
Return Value: | A Number. The mouse buttons that were pressed when the mouse event occured. If more than one button is pressed, the values are added. 1 : Left mouse button 2 : Right mouse button 4 : Wheel or middle button 8 : Fourth button (Browser Back) 16 : Fifth button (Browser Forward) For a left-hand configured mouse, the values are reversed. |
---|---|
DOM Version: | DOM Level 3 Events |
event.buttons
is a DOM Level 3 (2004) feature.
It is fully supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!