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>


posted on 2011-08-01 14:16  CarreyWu  阅读(195)  评论(0编辑  收藏  举报

导航