-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convertir a md web/api/keyboardevent/metakey [es] (#9307)
- Loading branch information
Showing
2 changed files
with
68 additions
and
85 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: KeyboardEvent.metaKey | ||
slug: Web/API/KeyboardEvent/metaKey | ||
translation_of: Web/API/KeyboardEvent/metaKey | ||
browser-compat: api.KeyboardEvent.metaKey | ||
--- | ||
|
||
{{APIRef("DOM Events")}} | ||
|
||
La propiedad **`KeyboardEvent.metaKey`** 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. | ||
|
||
> **Nota:** En teclados Macintosh es la tecla comando (<kbd>⌘</kbd>). En teclados Windows la tecla es lla tecla window (<kbd>⊞</kbd>). | ||
## Syntax | ||
|
||
``` | ||
var metaKeyPressed = instanceOfKeyboardEvent.metaKey | ||
``` | ||
|
||
### Valor de retorno | ||
|
||
{{jsxref("Boolean")}} | ||
|
||
## Ejemplo | ||
|
||
```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); | ||
} | ||
} | ||
``` | ||
|
||
## metaKey | ||
|
||
### Contenido HTML | ||
|
||
```html | ||
<div id="example" onmousedown="ismetaKey(event);">¡Presiona la tecla meta y dame click!<div> | ||
``` | ||
|
||
### Contenido Javascript | ||
|
||
```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!</br>metaKey:"+mK;//Muestra el valor de metaKey | ||
} | ||
``` | ||
{{ EmbedLiveSample('metaKey') }} | ||
|
||
## Especificaciones | ||
|
||
{{Specifications}} | ||
|
||
## Compatibilidad de Navegadores | ||
|
||
{{Compat}} | ||
|
||
## Véase también | ||
|
||
- {{ domxref("KeyboardEvent") }} |