ArchivedTools/PHP_Scripts/JS_Keypress/keypress.html

28 lines
490 B
HTML
Raw Permalink Normal View History

2023-12-21 00:31:35 +00:00
<html>
<head>
<script language="JavaScript">
function keyHandler(e)
{
var pressedKey;
if (document.all)
{
e = window.event;
}
if (document.layers || e.which)
{
pressedKey = e.which;
}
if (document.all)
{
pressedKey = e.keyCode;
}
pressedCharacter = String.fromCharCode(pressedKey);
alert(' Character = ' + pressedCharacter + ' [Decimal value = ' + pressedKey + ']');
}
document.onkeyup = keyHandler;
</script>
</head>
<body>
Press any key.
</body>
</html>