JavaScript IsNumeric Function

Below is the simple function to validate numeric with Javascript on your webpage.

function IsNumeric(sText)

{
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;

for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
TextBox1.value = 'Default';
IsNumber = false;
}
}
return IsNumber;
}

thanks.
lynnnay@2009

Popular posts from this blog

npm refusing to install as a dependency of itself

How to call javascript functions from VB.NET and using WebBrowser Control