Friday, 6 July 2012

Numaric validation in javascript

function validate(s)
         {
             var x = s.keyCode;
             var phn = document.getElementById('<%=TxtOFFZipCode.ClientID %>');
             var j = "0123456789"
             for (var i = 0; i < phn.value.length; i++) {
                
                 if (j.search(phn.value.charAt(i)) == -1) {
                     alert('Zip code  should be Numeric ');
                     phn.value = "";
                     return false;
                 }
             }

No comments:

Post a Comment