title: Allow some special character like dash in Javascript
body: <p>I'm using javascript to disallow user to use special character in textbox. But I want to allow user to use dash (-) in textbox. Kindly update my function.</p>
  
  <p>To Dis Allow user to use special character </p>
  
  <pre><code> function alpha(e) {
              var k;
              document.all ? k = e.keyCode : k = e.which;
              return ((k &gt; 64 &amp;&amp; k &lt; 91) || (k &gt; 96 &amp;&amp; k &lt; 123) || k == 8 || k == 32 || (k &gt;= 48 &amp;&amp; k &lt;= 57));
          }
  </code></pre>
  
  <p>Allow only numbers</p>
  
  <pre><code>function isNumberKey(evt) {
              var charCode = (evt.which) ? evt.which : evt.keyCode;
              if (charCode != 46 &amp;&amp; charCode &gt; 31
                &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))
                  return false;
  
              return true;
  </code></pre>
  
  <p>What is the keycode to allow use to use dash (-) in 1st function ?</p>