diff options
| author | MDN <actions@users.noreply.github.com> | 2021-09-09 00:49:39 +0000 |
|---|---|---|
| committer | MDN <actions@users.noreply.github.com> | 2021-09-09 00:49:39 +0000 |
| commit | fdc77da2ba02ff78b23fc129ec7ee20c0fa28afb (patch) | |
| tree | c194112508d253c64aebf8273cb8566fceaf8697 /files/zh-cn/web/api/keyboardevent | |
| parent | d6e1ef64cdf9b8592a58a30725c208753729b08a (diff) | |
| download | translated-content-fdc77da2ba02ff78b23fc129ec7ee20c0fa28afb.tar.gz translated-content-fdc77da2ba02ff78b23fc129ec7ee20c0fa28afb.tar.bz2 translated-content-fdc77da2ba02ff78b23fc129ec7ee20c0fa28afb.zip | |
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/web/api/keyboardevent')
| -rw-r--r-- | files/zh-cn/web/api/keyboardevent/which/index.html | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/files/zh-cn/web/api/keyboardevent/which/index.html b/files/zh-cn/web/api/keyboardevent/which/index.html deleted file mode 100644 index 56136f398e..0000000000 --- a/files/zh-cn/web/api/keyboardevent/which/index.html +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: KeyboardEvent.which -slug: Web/API/KeyboardEvent/which -tags: - - Code - - DOM - - Key - - KeyboardEvent - - keyCode - - which -translation_of: Web/API/KeyboardEvent/which ---- -<div>{{ APIRef("DOM Events") }} {{Deprecated_header}}</div> - -<p>{{domxref("KeyboardEvent")}} 接口的 <code><strong>which</strong></code> 只读属性返回所按下键的数字 <code>keyCode </code>或所按下字母数字键的字符代码 (<code>charCode</code>) 。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox notranslate">var <em>keyResult</em> = <em>event</em>.which; -</pre> - -<h3 id="返回值">返回值</h3> - -<ul> - <li><code>keyResult</code> contains the numeric code for a particular key pressed, depending on whether an alphanumeric or non-alphanumeric key was pressed. Please see {{domxref("KeyboardEvent.charCode")}} and {{domxref("KeyboardEvent.keyCode")}} for more details.</li> -</ul> - -<h2 id="例子">例子</h2> - -<pre class="brush: html notranslate"><html> -<head> -<title>charCode/keyCode/which example</title> - -<script type="text/javascript"> - -function showKeyPress(evt) { -alert("onkeypress handler: \n" - + "keyCode property: " + evt.keyCode + "\n" - + "which property: " + evt.which + "\n" - + "charCode property: " + evt.charCode + "\n" - + "Character Key Pressed: " - + String.fromCharCode(evt.charCode) + "\n" - ); -} - - -function keyDown(evt) { -alert("onkeydown handler: \n" - + "keyCode property: " + evt.keyCode + "\n" - + "which property: " + evt.which + "\n" - ); -} - -</script> -</head> - -<body - onkeypress="showKeyPress(event);" - onkeydown="keyDown(event);" -> - -<p>Please press any key.</p> - -</body> -</html> -</pre> - -<h2 id="规范">规范</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('DOM3 Events','#legacy-interface-KeyboardEvent','KeyboardEvent.which')}}</td> - <td>{{Spec2('DOM3 Events')}}</td> - <td>Initial definition; specified as deprecated</td> - </tr> - </tbody> -</table> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - - - -<p>{{Compat("api.KeyboardEvent.which")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{domxref("KeyboardEvent")}}, the interface this property belongs too.</li> -</ul> - -<div id="gtx-trans" style="position: absolute; left: 458px; top: 1890px;"> -<div class="gtx-trans-icon"></div> -</div> |
