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/event.altkey | |
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/event.altkey')
-rw-r--r-- | files/zh-cn/web/api/event.altkey/index.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/event.altkey/index.html b/files/zh-cn/web/api/event.altkey/index.html new file mode 100644 index 0000000000..10b91aab4f --- /dev/null +++ b/files/zh-cn/web/api/event.altkey/index.html @@ -0,0 +1,43 @@ +--- +title: event.altKey +slug: Web/API/event.altKey +translation_of: Web/API/MouseEvent/altKey +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>表明当事件触发时,ALT键是否处于按下的状态.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">event.altKey +</pre> +<h3 id="例子">例子</h3> +<pre><code><em>var bool</em> = event.altKey;</code> +</pre> +<p>如果当事件触发时,ALT键处于按下的状态,<code style="font-family: 'Courier New','Andale Mono',monospace; font-style: normal; font-variant: normal; font-size: 100%; line-height: normal; color: inherit; font-weight: inherit;">则bool</code>的值为<code style="font-family: 'Courier New','Andale Mono',monospace; font-style: normal; font-variant: normal; font-size: 100%; line-height: normal; color: inherit; font-weight: inherit;">true,否则为</code><code style="font-family: 'Courier New','Andale Mono',monospace; font-style: normal; font-variant: normal; font-size: 100%; line-height: normal; color: inherit; font-weight: inherit;">false</code>.</p> +<pre class="brush: html"><html> +<head> +<title>altKey 示例</title> + +<script type="text/javascript"> + +function showChar(e){ + alert( + "按下的键: " + String.fromCharCode(e.charCode) + "\n" + + "charCode: " + e.charCode + "\n" + + "是否按下ALT键: " + e.altKey + "\n" + ); +} + +</script> +</head> + +<body onkeypress="showChar(event);"> +<p> +按下一个字符键,尝试同时按下ALT键.<br /> +你也可以同时按下SHIFT键和ALT键. +</p> +</body> +</html> +</pre> +<h3 id="规范">规范</h3> +<p>DOM Level 2 Events - property of MouseEvent object</p> +<p>{{ languages( { "ja": "ja/DOM/event.altKey", "pl": "pl/DOM/event.altKey", "en": "en/DOM/event.altKey" } ) }}</p> |