如何把keycode转换成对应的内容

    技术2025-05-26  30

    通过下面的代码就可以得到用户输入的内容了,主要用在keypress事件中检查输入:

     

    var inputStr = '';         if (document.all) {             inputStr = String.fromCharCode(event.keyCode);         }         else {             inputStr = String.fromCharCode(e.which);         }

    最新回复(0)