aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/keyboardevent/metakey/index.html
blob: 4ed6385986bd8f8dbcd3774c5b9034011a3da3af (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
77
78
79
80
81
82
83
84
85
---
title: KeyboardEvent.metaKey
slug: Web/API/KeyboardEvent/metaKey
tags:
  - Evento
  - Referencia
translation_of: Web/API/KeyboardEvent/metaKey
---
<p>{{APIRef("DOM Events")}}</p>

<p>La propiedad <strong><code>KeyboardEvent.metaKey</code></strong>  es de solo lectura y regresa un valor {{jsxref("Boolean")}} que indica si la tecla <kbd>Meta</kbd> estaba presionada (true) o no (false) cuando el evento ocurrio.</p>

<div class="note">
<p><strong>Nota:</strong> En teclados Macintosh es la tecla comando (<kbd></kbd>). En teclados Windows la tecla es lla tecla window (<kbd></kbd>).</p>
</div>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">var metaKeyPressed = <em>instanceOfKeyboardEvent</em>.metaKey
</pre>

<h3 id="Valor_de_retorno">Valor de retorno</h3>

<p>{{jsxref("Boolean")}}</p>

<h2 id="Example" name="Example">Ejemplo</h2>

<pre class="brush: js"> function goInput(e) {
 // Revisa si estaba presionada la tecla meta y
   if (e.metaKey) {
        // realiza esto en caso de cierto
     superSizeOutput(e);
   } else {
         //Realiz esto en caso de falso
     doOutput(e);
   }
 }
</pre>

<h2 id="metaKey" name="metaKey">metaKey</h2>

<h3 id="Contenido_HTML">Contenido HTML</h3>

<pre class="brush: html">&lt;div id="example" onmousedown="ismetaKey(event);"&gt;¡Presiona la tecla meta y dame click!&lt;div&gt;
</pre>

<h3 id="Contenido_Javascript">Contenido Javascript</h3>

<pre class="brush: js">function ismetaKey(e){
 var el=document.getElementById("example");//Toma el control del div example
 var mK=e.metaKey;//Obtiene el valor de metaKey y lo almacena
 el.innerHTML="¡Presiona la tecla meta y dame click!&lt;/br&gt;metaKey:"+mK;//Muestra el valor de metaKey
}
</pre>

<p> </p>

<p>{{ EmbedLiveSample('metaKey') }}</p>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Especificación</th>
   <th scope="col">Status</th>
   <th scope="col">Comentario</th>
  </tr>
  <tr>
   <td>{{SpecName('DOM3 Events','#widl-KeyboardEvent-metaKey','KeyboardEvent.metaKey')}}</td>
   <td>{{Spec2('DOM3 Events')}}</td>
   <td>Definición inicial</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilidad de Navegadores</h2>

{{Compat("api.KeyboardEvent.metaKey")}}

<h2 id="See_also" name="See_also">Ver también</h2>

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