非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
MouseEvent.which
read-only property indicates which button was pressed on the mouse to trigger the event. The standard alternatives to this property are
MouseEvent.button
and
MouseEvent.buttons
.
var buttonPressed = instanceOfMouseEvent.which
A number representing a given button:
0
: No button
1
: Left button
2
: Middle button (if present)
3
: Right button
For a mouse configured for left-handed use, the button actions are reversed. In this case, the values are read from right to left.
This is not part of any specification.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
which
非标
|
Chrome 1 | Edge 12 |
Firefox
1
|
IE 9 | Opera 10.6 | Safari 3.1 | WebView Android Yes | Chrome Android Yes |
Firefox Android
4
|
Opera Android 11 | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
非标。预期跨浏览器支持较差。
见实现注意事项。
MouseEvent