aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/mouseevent/shiftkey/index.html
blob: 7dda99a8c370d9955b55fcc7050d36aa790c4b41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: MouseEvent.shiftKey
slug: Web/API/MouseEvent/shiftKey
translation_of: Web/API/MouseEvent/shiftKey
---
<p>{{APIRef("DOM Events")}}</p>

<p><strong><code>MouseEvent.shiftKey</code></strong>атрибут только для чтения , который указывает была ли нажата клавиша <kbd>shift</kbd>  . Возвращает (<code>true</code>) если нажата <kbd>shift</kbd>, (<code>false</code>) если нет.</p>

<h2 id="Синтаксис">Синтаксис</h2>

<pre class="syntaxbox">var <em>shiftKeyPressed</em> = <em>instanceOfMouseEvent</em>.shiftKey
</pre>

<h3 id="Возвращаемое_значение">Возвращаемое значение</h3>

<p>Логический</p>

<h2 id="Example">Пример</h2>

<pre class="brush: js">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;shiftKey example&lt;/title&gt;

&lt;script type="text/javascript"&gt;

function showChar(e){
  alert(
    "Key Pressed: " + String.fromCharCode(e.charCode) + "\n"
    + "charCode: " + e.charCode + "\n"
    + "SHIFT key pressed: " + e.shiftKey + "\n"
    + "ALT key pressed: " + e.altKey + "\n"
  );
}

&lt;/script&gt;
&lt;/head&gt;

&lt;body onkeypress="showChar(event);"&gt;
&lt;p&gt;Нажмите на любую символьную клавишу удерживая или не удерживая клавишу SHIFT.&lt;br /&gt;
Вы также можете использовать клавишу SHIFT вместе с клавишей ALT.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="Спецификация">Спецификация</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('DOM3 Events','#widl-MouseEvent-shiftKey','MouseEvent.shiftKey')}}</td>
   <td>{{Spec2('DOM3 Events')}}</td>
   <td>No change from {{SpecName('DOM2 Events')}}.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.shiftKey')}}</td>
   <td>{{Spec2('DOM2 Events')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Совместимость с браузерами</h2>

<p>{{Compat("api.MouseEvent.shiftKey")}}</p>

<h2 id="See_also">Смотрите также</h2>

<ul>
 <li>{{ domxref("MouseEvent") }}</li>
</ul>