aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/keyboardevent/which/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ru/web/api/keyboardevent/which/index.html')
-rw-r--r--files/ru/web/api/keyboardevent/which/index.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/files/ru/web/api/keyboardevent/which/index.html b/files/ru/web/api/keyboardevent/which/index.html
new file mode 100644
index 0000000000..d06f71133f
--- /dev/null
+++ b/files/ru/web/api/keyboardevent/which/index.html
@@ -0,0 +1,97 @@
+---
+title: KeyboardEvent.which
+slug: Web/API/KeyboardEvent/which
+tags:
+ - API
+ - DOM
+ - Deprecated
+ - Property
+ - Reference
+translation_of: Web/API/KeyboardEvent/which
+---
+<div>{{APIRef ("События DOM")}} {{Deprecated_header}}<br>
+Свойство which только для чтения интерфейса {{domxref ("KeyboardEvent")}} возвращает числовой код клавиши нажатой клавиши или код символа (charCode) для нажатой буквенно-цифровой клавиши.</div>
+
+
+
+<h2 id="Синтаксис">Синтаксис</h2>
+
+<pre class="syntaxbox">var <em>keyResult</em> = <em>event</em>.which;
+</pre>
+
+<h3 id="Параметры">Параметры</h3>
+
+<ul>
+ <li><code>keyResult содержит числовой код для конкретной нажатой клавиши, в зависимости от того, была ли нажата буквенно-цифровая или не буквенно-цифровая клавиша. Пожалуйста, смотрите {{domxref ("KeyboardEvent.charCode")}} и {{domxref ("KeyboardEvent.keyCode")}} для получения дополнительной информации.</code></li>
+</ul>
+
+<h2 id="Примеры">Примеры</h2>
+
+<pre class="brush: html">&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;charCode/keyCode/which example&lt;/title&gt;
+
+&lt;script type="text/javascript"&gt;
+
+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"
+ );
+}
+
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body
+ onkeypress="showKeyPress(event);"
+ onkeydown="keyDown(event);"
+&gt;
+
+&lt;p&gt;Please press any key.&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h2 id="Спецификации">Спецификации</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Специфиыкация</th>
+ <th scope="col">Статус</th>
+ <th scope="col">Комментарий</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="Browser_compatibility">Browser compatibility</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>