Simple Javascript Function Only Digit Allow In ASP NET

1)Digit Only

 <script type="text/javascript">

        function DigitOnly()
      {
            var charCode = event.keyCode;
            try
            {
                if (charCode > 31 && (charCode < 48 || charCode > 57 || charCode == 45))
            {
                    if (charCode == 46) {
                        return true;
                    }
                    return false;
              }
                return true;
            }
            catch (err) {
                alert(err.Description);
            }
        }

    </script>


Comments

Popular posts from this blog

String Program in C#

CSV using XmlNode

Extension Method & Partial Class