 <p>"Clear" JavaScript:</p> <pre><code>&lt;script type="text/javascript"&gt; function myKeyPress(e){ var keynum; if(window.event) { // IE keynum = e.keyCode; } else if(e.which){ // Netscape/Firefox/Opera keynum = e.which; } alert(String.fromCharCode(keynum)); } &lt;/script&gt; &lt;form&gt; &lt;input type="text" onkeypress="return myKeyPress(event)" /&gt; &lt;/form&gt; </code></pre> <p>JQuery:</p> <pre><code>$(document).keypress(function(event){ alert(String.fromCharCode(event.which)); }); </code></pre>