diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/api/mouseevent/altkey/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/api/mouseevent/altkey/index.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/mouseevent/altkey/index.html b/files/zh-cn/conflicting/web/api/mouseevent/altkey/index.html new file mode 100644 index 0000000000..382f62201d --- /dev/null +++ b/files/zh-cn/conflicting/web/api/mouseevent/altkey/index.html @@ -0,0 +1,45 @@ +--- +title: event.altKey +slug: conflicting/Web/API/MouseEvent/altKey +translation_of: Web/API/MouseEvent/altKey +translation_of_original: Web/API/event.altKey +original_slug: Web/API/event.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> |