diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/mouseevent/metakey | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/mouseevent/metakey')
-rw-r--r-- | files/zh-cn/web/api/mouseevent/metakey/index.html | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/mouseevent/metakey/index.html b/files/zh-cn/web/api/mouseevent/metakey/index.html new file mode 100644 index 0000000000..3857a4f284 --- /dev/null +++ b/files/zh-cn/web/api/mouseevent/metakey/index.html @@ -0,0 +1,112 @@ +--- +title: MouseEvent.metaKey +slug: Web/API/MouseEvent/metaKey +translation_of: Web/API/MouseEvent/metaKey +--- +<p>{{APIRef("DOM Events")}}</p> + +<p><strong><code>MouseEvent.metaKey</code></strong> 为只读属性,返回一个 {{jsxref("Boolean", "布尔值")}},在鼠标事件发生时,用于指示 <kbd>Meta</kbd> 键是按下状态(<code>true</code>),还是释放状态(<code>false</code>)。</p> + +<div class="note"> +<p><strong>备注:</strong>在 MAC 键盘上,表示 Command 键(<kbd>⌘</kbd>),在 Windows键盘上,表示 Windows 键(<kbd>⊞</kbd>)。</p> +</div> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var metaKeyPressed = <em>instanceOfMouseEvent</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> + +<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-MouseEvent-ctrlKey','MouseEvent.ctrlKey')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td>No change from {{SpecName('DOM2 Events')}}.</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.ctrlKey')}}</td> + <td>{{Spec2('DOM2 Events')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox (Gecko)</th> + <th>Chrome</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown()}}</td> + <td>{{CompatVersionUnknown()}}</td> + <td>{{CompatVersionUnknown()}}</td> + <td>{{CompatVersionUnknown()}}</td> + <td>{{CompatVersionUnknown()}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox Mobile (Gecko)</th> + <th>Android</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also" name="See_also">相关链接</h2> + +<ul> + <li>{{ domxref("MouseEvent") }}</li> +</ul> |