onkeydown_onkeypess_onkeyup

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function keydown(e) { var s="keydown:" + String.fromCharCode(e.keyCode)+ "\r\n"; show(s); } function keyup(e) { var s="keyup:" + String.fromCharCode(e.keyCode) + "\r\n"; show(s); } function keypress(e) { var s="keypress:" + String.fromCharCode(e.keyCode)+ "\r\n"; show(s); } function show(s) { var o=document.getElementById('s'); o.innerHTML +=s; } </script> </head> <body> <input type="text" size="10" onkeydown="keydown(event);" onkeyup="keyup(event);" onkeypress="keypress(event);" /> <br /> <textarea id='s' rows="20" cols="20"></textarea> </body> </html>


你可能感兴趣的:(onKeyDown)