title: Check for Bakcspace or Delete Key
body: <p>I'm playing with a textarea and trying to make it so the user cannot exceed maxLength unless the key pressed is a backspace or delete key. The problem is my keyCode conditional is always coming out to true. Why is that?</p>
  
  <pre><code>var maxLength = 500;
  window.onload = init;                // this seems to be a problem
  commentBox.onkeydown = checkLength;
  
  function checkLength(e)
  {
      var evt = e || window.event;
  
      if(countText() &lt; maxLength) //countText successfully returns number of nonwhitespace text.
          return true;
      else if(evt.keyCode == 46 || evt.keycode == 8)  // 46 = delete, 8 = backspace.
          return true;
      else
          return false;
  }
  </code></pre>
  
  <p>Here's a <a href="http://jsfiddle.net/3E7Ve/3/" rel="nofollow">JSFiddle</a> to help better understand. The delete key works in JSFiddle but not locally for some reason or another. Delete on the otherhand still does not work.</p>