// TODO:
var usrName = document.querySelector("#username"),
pwd = document.querySelector("#password"),
pwd2 = document.querySelector("#password-2");
var usrnRegExp = /\w{3,8}/, pwdRegExp = /.{6,20}/;
if(!usrnRegExp.test(usrName.value)) {
alert("用户名必须是3-10位英文字母或数字");
return false;
}
if(!usrnRegExp.test(pwd.value)) {
alert("口令必须是6-20位");
if(pwd.value!==pwd2.value) {
alert("两次输入口令必须一致");
return true;
Sign in to make a reply
凪
// TODO:
var usrName = document.querySelector("#username"),
pwd = document.querySelector("#password"),
pwd2 = document.querySelector("#password-2");
var usrnRegExp = /\w{3,8}/, pwdRegExp = /.{6,20}/;
if(!usrnRegExp.test(usrName.value)) {
alert("用户名必须是3-10位英文字母或数字");
return false;
}
if(!usrnRegExp.test(pwd.value)) {
alert("口令必须是6-20位");
return false;
}
if(pwd.value!==pwd2.value) {
alert("两次输入口令必须一致");
return false;
}
return true;
}