<script>
function callkeydownhandler(evnt) {
var ev = (evnt) ? evnt : event;
var code=(ev.which) ? ev.which : event.keyCode;
alert("El código de la tecla pulsada es: " + code);
}
if (window.document.addEventListener) {
window.document.addEventListener("keydown", callkeydownhandler, false);
} else {
window.document.attachEvent("onkeydown", callkeydownhandler);
}
</script>
Utilizando este pequeño código podremos saber que tecla ha pulsado un usuario en la página actual. Funciona perfectamente en Internet Explorer 8, que es especialmente conflictivo con antiguos métodos de detección
Hope that helps!!!!
Tags: capturar pulsación, detectar tecla, javascript
This entry was posted on Thursday, August 26th, 2010 at 15:59 and is filed under Informática. You can follow any responses to this entry through the RSS 2.0 feed. RSS 2.0. You can leave a response, or trackback from your own site.
November 25th, 2010 at 22:47
Me gustaria felicitarlos, muy digerible su blog. Luego checan el mio