hie..i'm a javascript newbie..can somebody help me with these codes??? been stuck with it for sometime????
is there any other way i can validate numeric numbers before submitting the form???
here are my codes....
<HTML>
<HEAD>
<SCRIPT>
function Validator(theForm)
{
if (frmCusInfo.txtFName.value == "")
{
alert("Please enter your name for the \"First Name\" field.");
frmCusInfo.txtFName.focus();
return (false);
}
if (frmCusInfo.txtLName.value == "")
{
alert("Please enter your name for the \"Last Name\" field.");
frmCusInfo.txtLName.focus();
return (false);
}
if (frmCusInfo.txtAge.value == "")
{
alert("Please enter your age for the \"Age\" field.");
frmCusInfo.txtAge.focus();
return (false);
}
// NEEDING HELP HERE!!
//if (IsNaN(frmCusInfo.txtAge.value))
// if (IsNaN(100))
// {
// alert("Please enter a numeric number for the \"Age\" field.");
// frmCusInfo.txtAge.focus();
// return (false);
// }
</SCRIPT>
</HEAD>
<BODY>
<FORM name=frmCusInfo onsubmit="return Validator(this)" method=post>
<BODY>
<TABLE name="tblCusInfo">
<TR>
<TD><FONT size=1 color=red></FONT>First Name</TD>
<TD><INPUT name=txtFName style="HEIGHT: 22px; WIDTH: 100px" ></TD>
<TD><FONT size=1 color=red></FONT>Last Name</TD>
<TD><INPUT name=txtLName style="HEIGHT: 22px; WIDTH: 100px" ></TD>
</TR>
<TR>
<TD><FONT size=1 color=red>*</FONT>Age</TD>
<TD><INPUT name=txtAge
style="HEIGHT: 22px; WIDTH: 26px"></TD>
</TR>
</TABLE>
<INPUT type=submit class=submit value="register" name=btnsubmit >
</FORM>
</BODY>
</HTML>
Enter your message below
Sign in or Join us (it's free).