hi,
in my project...in one of the textbox...i need to take either numbersnumbers or NULL..im not getting any idea..can anyone help me out..here is my jsp code and js code..
login.jsp
login.js
thanks,
madhu.
in my project...in one of the textbox...i need to take either numbersnumbers or NULL..im not getting any idea..can anyone help me out..here is my jsp code and js code..
login.jsp
Code:
<td><font color="#800000" size=""><b>L-Acct. No.</b></font></td>
<td><input type="text" name="localAccNo" value=NULL></td>
Code:
if (document.frm.localAccNo.value == "")
{
alert("Enter Local A/c No. or 'NULL' in capitals");
document.frm.localAccNo.focus();
return (false);
}
var chkLocalAccNo = "0123456789";
var chkLocalAccNoStr = document.frm.localAccNo.value;
var allchkLocalAccNoValid = true;
for (i = 0; i < chkLocalAccNoStr.length; i++)
{
ch = chkLocalAccNoStr.charAt(i);
for (j = 0; j < chkLocalAccNo.length; j++)
if (ch == chkLocalAccNo.charAt(j))
break;
if (j == chkLocalAccNo.length)
{
allchkLocalAccNoValid = false;
break;
}
}
if (!allchkLocalAccNoValid)
{
alert("Enter only numeric in the \" Local A/c No. \" field");
document.frm.localAccNo.focus();
return (false);
}
madhu.
Comment