Return to Snippet

Revision: 12681
at March 24, 2009 15:03 by jlvallelonga

Initial Code
function getCharacterPressed(e) {
	code = getKeyCode(e);
	keychar = "-1";
	if (isAlphaNumeric(code))
		keychar = String.fromCharCode(code);
	if (code == 8)
		keychar = "backspace";
	return keychar;

Initial URL

Initial Description
send in an event
it returns the key that you pressed if it was alphanumeric or backspace
otherwise it returns "-1"
use with getKeyCode and isAlphaNumeric

Initial Title

Initial Tags
event, code

Initial Language