I used the following code to echo the code of each key.
<script language="JavaScript">
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
alert("keycode: " + keycode);
}
</script>
How do I...
I have some code which checks for the enter key being pressed and then executes some code.
function enterPressed(evn) {
if (window.event && window.event.keyCode == 13) {
Some code
} else if (evn && evn.keyCode == 13) {
Some Code
}
}
document.onkeypress = enterPressed;
It works on every...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.