//Take one text box and call the function obblur method........
asp:TextBox ID="txt" runat="server" onblur="ValidateCCNum(this);">
//.js File
function ValidateCCNum(ccNum)
{
var ccno = ccNum.value;
if(ccno == "")
{
return true;
}
if(isNaN(ccno))
{
alert("Credit card number should be numeric");
ccNum.value="";
ccNum.focus();
return false;
}
if(ccno.length < 14 || ccno.length >18)
{
alert("Credit card number should have 14-18 digits length");
ccNum.value="";
ccNum.focus();
return false;
}
return true;
}
Tuesday, April 13, 2010
Subscribe to:
Posts (Atom)