Javascript code for email validation

if( !IsNumeric(document.getElementById(“amount”).value))
{
alert(“Please enter the amount in numeric format”);
return false;
}

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)
{
IsNumber = false;
}
}
return IsNumber;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s