Return to Snippet

Revision: 61314
at December 5, 2012 21:34 by laxman2021


Initial Code
<script language=Javascript>
    
      function isSpaceKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode == 32))
             {
              alert("Spaces are not allowed");
              return true;
             }
         else ((charCode >= 47 && charCode <= 58))
                 {
                     alert("Numerics are not allowed");
                     return true;
                 }
         return true;
      }
  
   </script>
 
 <script language=Javascript>
    
      function isAlphaKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode >= 47 && charCode <= 58))
             {
              alert("Enter Numeric Values");
              return true;
             }
         return true;
      }
  
   </script>

Initial URL
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

Initial Description
Validates Numericals in a text box.

Validates spaces in a text box.

Initial Title
Onkeypress event Javascript spacekey event Validation for (Integers, Spaces) Textbox.

Initial Tags
validation

Initial Language
PHP