Key codes for the number and punctuation keys are the same as the ASCII code of the number on the key

解决方案 »

  1.   

    <script>
    function test()
    {
      window.status=window.event.KeyCode;
    //  window.status=window.event.shiftKey;
    //  window.status=window.event.ctrlKey;
    //  window.status=window.event.altKey;
    }
    </script><body onkeydown="Javascript:test();">
      

  2.   

    这样就可以自己解决了!
    <body onkeyPress="javascript:alert(window.event.keyCode);">
      

  3.   

    为什么以下函数无法防止输入汉字,怎样解决?
    function onlyNum()
     {
     
     if((event.keyCode>57||event.keyCode<43)||event.keyCode==44||event.keyCode==47)
     event.keyCode=0;
      }