<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>js 按键记录</TITLE> </HEAD> <BODY> <script type="text/javascript"> var keystring = "";//记录按键的字符串…
document.onkeydown = function (e) { if (!e) e = window.event; if ((e.keyCode || e.which) == 13) { var obtnLogin = document.getElementById("submit_btn"); //submit_btn为按钮ID obtnLogin.focus(); } }…
通过js绑定键盘按下事件onkeydown获取每个按键的ascII值. js获取每个按键的ascii值 <script language="javascript"> //获取每个按键的值 function keyDown() { var keycode=event.keyCode; var keychar=String.fromCharCode(keycode); console.log('ASCII='+keycode+'\nKeyChar='+keychar); } d…