//textbox onblur Event
asp:TextBox ID="TextBox1" runat="server" onblur="Checktextboxlenth(this);">/asp:TextBox>
//.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;
}
Wednesday, September 8, 2010
text box will not take more than 5 character
//.js file
function Checktextboxlenth(ccNum)
{
var ccno = ccNum.value;
if(ccno.length < 0 || ccno.length >5)
{
alert("length cant acces 5 character");
return false ;
}
return true;
}
////onpageload
btnId1.Attributes.Add("onclick", "Checktextboxlenth(TextBox1)");
function Checktextboxlenth(ccNum)
{
var ccno = ccNum.value;
if(ccno.length < 0 || ccno.length >5)
{
alert("length cant acces 5 character");
return false ;
}
return true;
}
////onpageload
btnId1.Attributes.Add("onclick", "Checktextboxlenth(TextBox1)");
Subscribe to:
Posts (Atom)