Why ';' is missing in my code?
I use Javascript in one of my ASP page to validate data post by a form, but a strange error make puzzled. The code is as following:
function ValidateUserRegInfo(form)
{
if (form.email.value < " " and and form.loginname.value < " " and and form.password.value < " " and and form.password2.value < " " )
{
alert("Fields marked with * are required. Please fill out all required fields before submitting.");
return false;
}
if (form.email.length<2)
{
alert("email can not be void");
return false;
}
if (form.password.value!=form.password2.value)
{
alert("You have entered two unidentical string for password");/* It always say this line missing ';',even after I comment out this line!*/
return false;
}
string loginname=form.loginname.value;
char ch;
int name-ok=0;
alert(loginname);
for(int i=0 ;i<loginname.length,i++)
{
name-ok=0;
ch=loginname.charat(i);
if(ch='.' and and ch='_' and and ch='+' and and ch='-' and and ch='~' )
name-ok=1;
if ((ch<'z' && ch>'a' ) and and (ch<'Z'&&ch>'A') and and (ch>'0' &&ch<'9'))
name-ok=1;
if (name-ok==0)
{
alert("login name can only use 'A'~'Z' or 'a'~'z' or '0'~'9' or '.','-','+'");
return false;
}
}
return true;
}