< html > < head > < title > study 023 </ title > < script language ="javascript" type ="text/javascript" > ... function DisplayKey(e)...{ if (e.keyCode) keycode = e.keyCode; else keycode = e.which; character = String.fromCharCode(keycode); k = document.getElementById("keys"); k.innerHTML += character;} </ script ></ head > < body onKeyPress ="DisplayKey(event);" > < h1 > 显示输入的字符 </ h1 > < p id ="keys" ></ p > </ body > </ html >