Tuesday 27 July, 2010

ASCII Key Values

Use this script to determine the JavaScript key code of a selected key. Just press a key and an alert box will display the corresponding keycode.

document.onkeydown = checkKeycode

function checkKeycode(e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
alert("keycode: " + keycode);
}

No comments:

Post a Comment