<html> <body> <input type="text" name=tb1 id=tb1 value=""> <script language="javascript"> function keygen() { document.all.tb1.value = event.keyCode; } document.onkeydown = keygen; </script> </body> </html>