aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/keyboardevent/metakey
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/keyboardevent/metakey
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/keyboardevent/metakey')
-rw-r--r--files/zh-cn/web/api/keyboardevent/metakey/index.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/keyboardevent/metakey/index.html b/files/zh-cn/web/api/keyboardevent/metakey/index.html
new file mode 100644
index 0000000000..8548733aed
--- /dev/null
+++ b/files/zh-cn/web/api/keyboardevent/metakey/index.html
@@ -0,0 +1,66 @@
+---
+title: KeyboardEvent.metaKey
+slug: Web/API/KeyboardEvent/metaKey
+tags:
+ - API
+ - MouseEvent
+translation_of: Web/API/KeyboardEvent/metaKey
+---
+<p>{{APIRef("DOM Events")}}</p>
+
+<p><strong><code>KeyboardEvent.metaKey</code></strong> 为只读属性,返回一个 {{jsxref("Boolean", "布尔值")}},在事件发生时,用于指示 <kbd>Meta</kbd> 键是按下状态(<code style="font-style: normal;">true</code>),还是释放状态(<code style="font-style: normal;">false</code>)。</p>
+
+<div class="note">
+<p>备注:在MAC键盘上,表示 Command 键(<kbd>⌘</kbd>),在Windows键盘上,表示 Windows 键(<kbd>⊞</kbd>)。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">var metaKeyPressed = <em>instanceOfKeyboardEvent</em>.metaKey
+</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>一个布尔值</p>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<pre class="brush: js"> function goInput(e) {
+ // 检测metaKey值
+ if (e.metaKey) {
+ // 继续处理事件
+ superSizeOutput(e);
+ } else {
+ doOutput(e);
+ }
+ }
+</pre>
+
+<p>{{ EmbedLiveSample('Example', 400, 36) }}</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范版本</th>
+ <th scope="col">规范状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM3 Events','#widl-KeyboardEvent-ctrlKey','KeyboardEvent.ctrlKey')}}</td>
+ <td>{{Spec2('DOM3 Events')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
+
+<p>{{Compat("api.KeyboardEvent.metaKey")}}</p>
+
+<h2 id="See_also" name="See_also">相关链接</h2>
+
+<ul>
+ <li>{{ domxref("KeyboardEvent") }}</li>
+</ul>