javascript - How to distinguish between keyboard character's keycodes -


i making simple program binds each key character.
noticed keycode of ' key same right arrow key. both 39.

how can distinguish between these 2 (and other conflicts). please dont tell me use key combination right arrow. dont want that.
alerter alerts code (ive tested , both give 39):

<html><head>  <meta http-equiv="content-type" content="text/html; charset=utf-8">  <script type="text/javascript">  function code(e) {      e = e || window.event;      return(e.keycode || e.which);  }  window.onload = function(){      document.onkeypress = function(e){          var key = code(e);          alert(key);      };  };  </script>  </head>  <body>  </body>  </html>


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -