We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

MouseEvent.metaKey

MouseEvent.metaKey 为只读属性,返回一个 布尔值,在鼠标事件发生时,用于指示 Meta 键是按下状态(true),还是释放状态(false)。

备注:在 MAC 键盘上,表示 Command 键(),在 Windows键盘上,表示 Windows 键()。

语法

var metaKeyPressed = instanceOfMouseEvent.metaKey

返回值

一个布尔值。

示例

 function goInput(e) {
 // 检测 metaKey 值
   if (e.metaKey) {
        // 继续处理事件
     superSizeOutput(e);
   } else {
     doOutput(e);
   }
 }

规范

规范版本 规范状态 备注
Document Object Model (DOM) Level 3 Events Specification
MouseEvent.ctrlKey
Obsolete No change from Document Object Model (DOM) Level 2 Events Specification.
Document Object Model (DOM) Level 2 Events Specification
MouseEvent.ctrlKey
Obsolete Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ?

相关链接

文档标签和贡献者

此页面的贡献者: AlexChao
最后编辑者: AlexChao,