<html> <head> <title></title> </head> <body> <script type="text/javascript"> function a(){ alert("キーを押しました"); } </script> <input type="text" name="txt" onKeyPress="a();"> </body> </html>