function validate()
{
var usernameValue=document.getElementById("usernameId");
var passwordValue=document.getElementById("password");
var repasswordValue=document.getElementById("repassword");
alert("validate()");
if(usernameValue.length==0)
{
alert("111111111111");
alert("username should not be blank!");
return false;
}
else if(usernameValue.length<6||usernameValue.length>10)
{
alert("length of username should be between 6 and 10!");
return false;
}
if(passwordValue.length==0)
{
alert("password should not be blank!");
return false;
}
else if(passwordValue.length<6||passwordValue.length>10)
{
alert("length of password should be between 6 and 10!");
return false;
}
if(repasswordValue.length==0)
{
alert("repassword should not be blank!");
return false;
}
else if(repasswordValue.length<6||repasswordValue.length>10)
{
alert("length of repassword should be between 6 and 10!");
return false;
}
return true;
}
............................
..................
...................
不管输入的用户名长度是否符合要求长度,都会提交。
请帮忙看下什么地方不对呢。我用的是MEclipse 7.5