title: how to define event below
body: <p>I have a function below where it doesn't allow the user to type in letters in a textbox but it keeps saying event is undefined. Where and how am I suppose to define event?</p>
  
  <p>Below is the function:</p>
  
  <pre><code>function isNumberKey(evt)
    {
       var charCode = (evt.which) ? evt.which : event.keyCode
       if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))
          return false;
  
       return true;
    }
  </code></pre>
  
  <p>Below is the html where this could be used:</p>
  
  <pre><code>onkeypress="return isNumberKey(event)"
  </code></pre>