Return to Snippet

Revision: 6421
at May 20, 2008 13:23 by mattkenefick


Initial Code
var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1);

var keyPressed = 0;

if(!isIE){
	document.captureEvents(Event.KEYPRESS);
}

function captureKeyboard(e) {

	e=e?e:event;
	
	document.title = event.keyCode + ' - ' + e.keyCode;
	
    if (isIE) {
        keyPressed = e.keyCode;
	}else{
		keyPressed = e.charCode;	
	}
	
	window.status = keyPressed;
    return true;

}

Initial URL

                                

Initial Description
Usage:

Initial Title
Javascript: Keyboard Capture

Initial Tags
javascript

Initial Language
JavaScript