function validtForSpclChar()
{
var chkStr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var chkTxt = form1.TextBox1.value;
var allValid = true;
for (i = 0; i <>
{
ch = chkTxt.charAt(i);
for (j = 0; j <>
if (ch == chkStr.charAt(j))
break;
if (j == chkStr.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Enter only letter and numeric characters in the \"TextBox\" field.");
form1.TextBox1.focus();
return (false);
}
}
call this function in form's onsubmit event
form id="form1" runat="server" onsubmit="return validtForSpclChar(this)"
No comments:
Post a Comment