aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/api/event/ctrlkey/index.html
blob: 02fe7f82bfe0e91e9893137835f092ba86ba9b4f (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
---
title: event.ctrlKey
slug: Web/API/Event/ctrlKey
tags:
  - DOM
  - Gecko
  - Reference_del_DOM_di_Gecko
  - Tutte_le_categorie
translation_of: Web/API/MouseEvent/ctrlKey
---
<p>{{ ApiRef() }}</p>
<h3 id="Sommario" name="Sommario">Sommario</h3>
<p>Indica se il tasto CTRL è stato premuto mentre l'evento si verificava.</p>
<h3 id="Sintassi" name="Sintassi">Sintassi</h3>
<pre class="eval"><i>bool</i> = event.ctrlKey
</pre>
<p><code>bool</code> vale <code>true</code> se il tasto CTRL era premuto, altrimenti <code>false</code>.</p>
<h3 id="Esempio" name="Esempio">Esempio</h3>
<pre>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;esempio tasto control&lt;/title&gt;

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

function mostraCarattere(e){
  alert(
    "Tasto premuto: " + String.fromCharCode(e.charCode) + "\n"
    + "Codice carattere: " + e.charCode + "\n"
    + "Tasto CTRL premuto: " + e.ctrlKey + "\n"
  );
}

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

&lt;body onkeypress="mostraCarattere(event);"&gt;
&lt;p&gt;Prova a premere un tasto tenendo premuto CTRL e prova a premere un tasto senza premere CTRL.&lt;br /&gt;
Puoi anche provare a premere CTRL+SHIFT.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3 id="Specifiche" name="Specifiche">Specifiche</h3>
<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-MouseEvent-ctrlKey">ctrlKey </a></p>
<p>{{ languages( { "en": "en/DOM/event.ctrlKey", "pl": "pl/DOM/event.ctrlKey" } ) }}</p>