Javascript KeyCode vs CharCode = Utter Confusion
<p>The problem:</p>

<ul>
<li>Limit allowed characters in a HTML input to a-z A-Z only.</li>
<li>For business requirements this needs to be done on KeyPress so that the character simply isnt allowed to even appear in the input.</li>
<li>Tab, enter, arrows, backspace, shift are all allowed. The user must be able to freely move in and out of the textbox, delete characters etc etc.</li>
</ul>

<p>This is the starting point of my code...</p>

<pre><code>var keyCode = (e.keyCode ? e.keyCode : e.which);
</code></pre>

<p>However every value that I get in <em>keyCode</em> doesnt correspond to <em>any</em> of the character charts I have seen on the web. For example the character "h" gives me a return code of 104.</p>

<p>Is KeyCode different to CharCode? Which code contains the control characters? Do I need to convert?</p>

<p>How can I restrict the input to a-z A-Z and allow the keys I need in javascript?</p>

<p>Many thanks.</p>
