
17/12/2002, 13:44
|
 | Usuario no validado | | Fecha de Ingreso: mayo-2001 Ubicación: Zaragoza
Mensajes: 1.304
Antigüedad: 23 años, 10 meses Puntos: 25 | |
Con este código, detectas cualquier tecla (incluidos alt, ctrl, función, cursor...)
<script>
var tecla
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
document.onkeydown = keyDown
if (ns4) document.captureEvents(Event.KEYDOWN)
function keyDown(e) {
if (ns4) {
var nKey = e.which
tecla=nKey
}
if (ie4) {
var ieKey = event.keyCode
tecla=ieKey
}
alert('Código'+tecla)
}
</script> |