-
Contributing Member
Re: JavaScript form address field validations
Hi ashaflint,
I think it is easy to give the alert message when the user enters only numbers or alphabets or characters...Look at the following script, now i give the alert message when the user enters only numbers.
function checkAddress(sText)
{
var ok = "0123456789";
var f=true;
var Char;
for (i = 0; i < sText.length && f == true; i++)
{
Char = sText.charAt(i);
if (ok.indexOf(Char) == -1)
{
f = false;
}
}
if (f==true)
{
alert("user enters only numbers");
}
}
So you can change this script to alphabets or characters also. The only thing is you should change the value of "ok". In the above function i give only numbers. I hope this will help to you.
-----------------------
suresh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules