one, just to learn more about javascript, two for future use as a quick reference tool.
however im having problems getting the KeyCode to return in an alert box, and im unsure as to why.
While searching for an answer the closest thing i found was this. Look on the bottom of the page to find something similar to what i was looking to make:
JavaScript - Detecting keystrokes
i did read his source and found the appropriate function and form however i still dont understand why My attempt failed. while it would be easier just to copy/paste his code into an offline document and call it done i wouldnt truely understand where or why i failed.
i repeatedly searched to find the correct code to tell javascript to give me the keyvalue back but nothing came of it that worked, or rather that i understood fully i suppose.
<html>
<head>
<script type="text/javascript">
function getkey(){
key=keyCode;
alert(key);
}
</script>
</head>
<body onKeyDown=getkey();>
</body>
</html>
i know everything works except javascript returning the keycode to the alert.


Sign In
Create Account


Back to top









