JavaScript - How to detect CTRL + key in Firefox on Ubuntu

 
Vista:

How to detect CTRL + key in Firefox on Ubuntu

Publicado por Txus (1 intervención) el 16/05/2012 12:55:50
HI,

I'm trying to detect the combo CTRL + P using javascript, but it's impossible.
I can detect the CTRL key, but no the 'P' key. So I cannot do:

if(ev.ctrlKey && ev.keyCode=80){
alert("yes!");
}

INFO:
Ubuntu 11.10 (oneiric)
GNOME 2.32.1
Firefox for Ubuntu canonical 1.0


Thanks
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.162
Oro
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

How to detect CTRL key in Firefox on Ubuntu

Publicado por xve (2100 intervenciones) el 16/05/2012 22:16:16
La combinación de CTRL + P es interceptada por el navegador para imprimir...
Por ejemplo, si pruebas a capturar CTRL + G veras que te funciona correctamente.

Este es el código que he utilizado:
1
2
3
4
5
6
<script type='text/javascript'>
    // Controlamos que si pulsamos escape se cierre el div
    $(document).keyup(function(event){
        alert(event.which)
    });
</script>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar