Javascript Key Detection

Example

UP
LEFT
DOWN
RIGHT

How To Use

Include the keys.js script.
<script src="keys.js" type="text/javascript"></script>
And add key detection to the body tag
<body onkeydown="keydown(event)" onkeyup="keyup(event)">
The script (by default) is designed to be used with a game and sets 5 variables, moveleft, movedown, moveup, moveright, spacedown to true or false depending on wether or not the key is pressed. It can easily be adapted to any use though.