如何准确地使用JavaScript记录键盘输入?
TextBox1.value=TextBox1.value + " " + String.fromCharCode(event.keyCode);
<input type="text" id="txt" />
<script>
document.onkeypress = function (e) {
e = e
[解决办法]
window.event;
txt.value += ' ' + String.fromCharCode(e.keyCode
[解决办法]
e.which);
}
</script>