Foros del Web » Programando para Internet » Javascript » Frameworks JS »

mostrar alert al precionar cualquier letra

Estas en el tema de mostrar alert al precionar cualquier letra en el foro de Frameworks JS en Foros del Web. Hola quisiera saber si con jquery se puede mostrar un alert cuando se precione cualquier tecla...o sea cualquier tecla del teclado...como se hace??? gracias...
  #1 (permalink)  
Antiguo 20/09/2011, 16:57
 
Fecha de Ingreso: septiembre-2011
Mensajes: 480
Antigüedad: 12 años, 7 meses
Puntos: 18
mostrar alert al precionar cualquier letra

Hola quisiera saber si con jquery se puede mostrar un alert cuando se precione cualquier tecla...o sea cualquier tecla del teclado...como se hace??? gracias
  #2 (permalink)  
Antiguo 21/09/2011, 17:22
Avatar de livemusic  
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Respuesta: mostrar alert al precionar cualquier letra

justo andaba con un codigo ... espero y te funcione ...

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Documento sin título</title>
  5. <script src="http://www.google.com/jsapi"></script>  
  6. <script type="text/javascript">
  7.     google.load("jquery", "1.6.2");
  8. <script type="text/javascript">
  9. $(function(){
  10.     $(document).keydown(checkKey);
  11. })
  12.  
  13. function checkKey(e){
  14.     var valor = String.fromCharCode(e.which);
  15.     alert(valor);
  16. }
  17. </head>
  18. </body>
  19. </html>



Etiquetas: jquery, letra, alerta
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:34.