Javascript examples for DOM:Key Event
KeyEvent charCode Property - Get the Unicode value of the pressed keyboard key via charCode or keyCode property
<!DOCTYPE html> <html> <body> <input type="text" size="40" onkeypress="myFunction(event)"> <p id="demo"></p> <script> function myFunction(event) {//from w w w . j a v a 2s . com var x = event.charCode || event.keyCode; document.getElementById("demo").innerHTML = "The Unicode value is: " + x; } </script> </body> </html>