Created
January 11, 2011 02:58
-
-
Save walterdavis/773948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
// <![CDATA[ | |
document.observe('dom:loaded',function(){ | |
document.observe('keypress', function(evt){ | |
var code; | |
if (evt.keyCode) code = evt.keyCode; | |
else if (evt.which) code = evt.which; | |
var character = String.fromCharCode(code); | |
$('message').update('Code was ' + code + ', Character was ' + character); | |
}); | |
}); | |
// ]]> | |
</script> | |
<title>KeyCode Translator</title> | |
</head> | |
<body> | |
<div id="message"> | |
Press any key to continue... | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment