ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Life >

JS function: Get key code

Wednesday on July 11th, 2007Life

JS function: Get key keycode

Get key

< script language=" javascript"> function keyDown() { var keycode=event.keyCode; var keychar=String.fromCharCode(keycode); alert('ASCII='+keycode+'\nKeyChar='+keychar); } document.onkeydown=keyDown; </script>

Use ENTET instead of TAB

< script language=" javascript">function keyDown(){var keycode=event.keyCode;var keyChar=String.fromCharCode(keycode);if(keycode==13)event.keyCode=9;};document.onkeydown=keyDown;</script>

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/JS-function-Get-key-code.htm