From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- files/es/web/api/keyboardevent/which/index.html | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 files/es/web/api/keyboardevent/which/index.html (limited to 'files/es/web/api/keyboardevent/which/index.html') diff --git a/files/es/web/api/keyboardevent/which/index.html b/files/es/web/api/keyboardevent/which/index.html new file mode 100644 index 0000000000..11e1e3e48e --- /dev/null +++ b/files/es/web/api/keyboardevent/which/index.html @@ -0,0 +1,62 @@ +--- +title: event.which +slug: Web/API/KeyboardEvent/which +tags: + - DOM + - events + - metodo + - which +translation_of: Web/API/KeyboardEvent/which +--- +

{{ ApiRef() }}

+

Resumen

+

Devuelve el keyCode de la tecla presionada, o el codigo del caracter (charCode) de la tecla alfanumerica presionada.

+

Sintaxis

+
var keyResult = event.which;
+
+

keyResult contiene el codigo numerico para una tecla en particular, dependiendo si la tecla presionada es alfanumerica o no-alfanumerica. Por favor mire charCode y keyCode para mas informacion.

+

Ejemplo

+
<html>
+<head>
+<title>charCode/keyCode/which example</title>
+
+<script type="text/javascript">
+
+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"
+     );
+}
+
+
+</script>
+</head>
+
+<body
+ onkeypress="showKeyPress(event);"
+ onkeydown="keyDown(event);"
+>
+
+<p>Por favor presione cualquier tecla.</p>
+
+</body>
+</html>
+
+
+ Nota: El codigo de arriba falla en Firefox 9 debido al bug 696020.
+

Especificacion

+

No es parte de ninguna especificacion.

-- cgit v1.2.3-54-g00ecf