title: Javascript function doesn't work on all browser
body: <p>I have created a <code>fnNumericDecimalOnly</code> function Javascript,
  and using it in my jsp page which allow only Numbers and decimal not other than that like in below code.</p>
  
  <p>Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function fnNumericDecimalOnly(event) {     
      if (event.keyCode &lt; 45 || event.keyCode &gt; 58) {
          event.returnValue = false;
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="col-sm-4 col-lg-4"&gt;
      &lt;div class="form-group has-feedback required-field-block"&gt;
          &lt;label for="inTimeTxt" class="col-md-4 control-label"&gt;In Time&lt;/label&gt;
          &lt;div class="col-md-7"&gt;
  
              &lt;input id="inTimeTxt" name="inTimeTxt" class="form-control" maxlength="5"
                     type="text" placeholder="00:00" value="" title="In Time" 
                     onkeypress="javascript:return fnNumericDecimalOnly(event)" 
                     data-tooltip="tooltip" data-placement="top" /&gt;(In hh:mm format)
  
              &lt;span class="glyphicon form-control-feedback" id="inTimeTxtMessage"&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="col-md-1"&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It is working only in Chrome but not in Firefox.
  So can anyone help me? What can I do so that it works for all browsers?</p>