title: Javascript special character validation
body: <pre><code>&lt;script language="JavaScript"&gt;
  var mikExp = /[$\\@\\\#%\^\&amp;\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
  function dodacheck(val) 
  {
      var strPass = val.value;
      var strLength = strPass.length;
      var lchar = val.value.charAt((strLength) - 1);
      if(lchar.search(mikExp) != -1) 
      {
          var tst = val.value.substring(0, (strLength) - 1);
          val.value = tst;
      }
  }
  &lt;/script&gt;
  
  &lt;input type="text" name="display1" id="display1" value="&lt;?php echo $wc['display1']; ?&gt;" class="width241 input fnt11" onKeyUp="javascript:dodacheck(xyz.display1);" maxlength="20"&gt;
  </code></pre>
  
  <p>This function makes sure that special characters are not printed in a input box.
  But when i press shift and press any special characters for more than 5 seconds its prints the special characters.</p>
  
  <p>Any clues how to stop it from happening?</p>