通过下面的代码就可以得到用户输入的内容了,主要用在keypress事件中检查输入:
var inputStr = ''; if (document.all) { inputStr = String.fromCharCode(event.keyCode); } else { inputStr = String.fromCharCode(e.which); }