Hi, I have a page and I need the page to pop-up a little alert box when the keys: A, S, or D are pressed How do I do this? Thanks!
<html> <head> <script type="text/javascript"> <!-- window.onkeydown = function(e) { if (!e) var e = window.event; if (e.keyCode) var code = e.keyCode; else if (e.which) var code = e.which; switch(String.fromCharCode(code)) { case 'A': alert('A was pressed'); break; case 'S': alert('S was pressed'); break; case 'D': alert('D was pressed'); break; } } --> </script> </head> <body> My document </body> </html> HTML: