<html> <head> <meta charset="utf8"> <title>Demo</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script type="text/javascript"> function GetKeyNumber (event) { alert(event.keyCode); } </script> </head> <body onkeydown="GetKeyNumber(event);"> </body> </html>
參考資料:
http://www.w3schools.com/jsref/event_onkeydown.asp
http://api.jquery.com/keypress/
http://api.jquery.com/keydown/
http://help.dottoro.com/ljlkwans.php