火狐下获取键盘按下值(兼容多种浏览器)

<script language="javascript">
  function keyUp(e) {
    var currKey=0,e=e||event;
    currKey=e.keyCode||e.which||e.charCode;
    var keyName = String.fromCharCode(currKey);
    alert("按键码: " + currKey + " 字符: " + keyName);
  }
  document.onkeyup = keyUp;

 </script>

 

你可能感兴趣的:(JavaScript,浏览器)