--- title: MouseEvent.metaKey slug: Web/API/MouseEvent/metaKey translation_of: Web/API/MouseEvent/metaKey ---
{{APIRef("DOM Events")}}
MouseEvent.metaKey 为只读属性,返回一个 {{jsxref("Boolean", "布尔值")}},在鼠标事件发生时,用于指示 Meta 键是按下状态(true),还是释放状态(false)。
备注:在 MAC 键盘上,表示 Command 键(⌘),在 Windows键盘上,表示 Windows 键(⊞)。
var metaKeyPressed = instanceOfMouseEvent.metaKey
一个布尔值。
function goInput(e) {
// 检测 metaKey 值
if (e.metaKey) {
// 继续处理事件
superSizeOutput(e);
} else {
doOutput(e);
}
}
| 规范版本 | 规范状态 | 备注 |
|---|---|---|
| {{SpecName('DOM3 Events','#widl-MouseEvent-ctrlKey','MouseEvent.ctrlKey')}} | {{Spec2('DOM3 Events')}} | No change from {{SpecName('DOM2 Events')}}. |
| {{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.ctrlKey')}} | {{Spec2('DOM2 Events')}} | Initial definition. |