onkeypress event not working in firefox ? how to fix it?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4496910/onkeypress-event-not-working-in-firefox">onKeyPress event not working in Firefox</a>  </p>
</blockquote>



<pre><code>&lt;div&gt;&lt;textarea maxlength="1000" rows ="5" cols ="5" 
   style="width:398px; height: 175px; overflow: auto; padding: 4px !important" 
   name="body" value="" id="body" onkeypress="imposeMaxLength(this, 10);"  
   onPaste="imposeMaxLength(this, 10);" /&gt;&lt;/textarea&gt;&lt;/div&gt;
&lt;script&gt;
function imposeMaxLength(field, MaxLen){

    if (field.value.length &gt; (MaxLen-1)) {
        alert("It cannot exceed " + MaxLen + " characters.");
        field.value= field.value.substr(0, (MaxLen);
    }
}
&lt;/script&gt;
</code></pre>
