<!DOCTYPE html> <html> <body> <p><b>OnKeyDown JavaScript Example<b></p> <input type="text" id="txtKey"onkeydown="onKeyDown()"> <script> function onKeyDown() { alert("You press the down arrow key in the text box"); } </script> </body> </html>