The MouseEvent.getModifierState()
method returns the current state of the specified modifier key: true
if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false
.
See the document of KeyboardEvent.getModifierState()
for details.
语法
var active = event.getModifierState(keyArg);
返回值
A Boolean
参数
keyArg
- A modifier key value. The value must be one of the
KeyboardEvent.key
values which represent modifier keys or"Accel"
. This is case-sensitive.
规范
Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 3 Events Specification getModifierState() |
Obsolete | Initial definition. |
浏览器兼容性
BCD tables only load in the browser
See also
- The
MouseEvent
this method belongs to. KeyboardEvent.getModifierState