ArchivedTools/PHP_Scripts/JS_Keypress/keypress.html
2023-12-21 01:31:35 +01:00

28 lines
490 B
HTML

<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>