[removed] //sNameCheck() && passCheck() && bdaycheck() function validateform(){ if(sNameCheck() && passCheck()&&bdaycheck;()) return true; else return false; } // Login Name Validation function sNameCheck(){ var strName = document.userfrm.sname.value; if(strName.length != 0) { return true; } else { alert("请输入用户名"); return false; } } function passCheck(){ var userpass = document.userfrm.pass.value; var ruserpass = document.userfrm.rpass.value; if(userpass == "" && ruserpass == ""){ alert("未输入密码 \n" + "请输入密码"); document.userfrm.pass.focus(); return false; } if(userpass.length < 6){ alert("密码必须多于或等于 6 个字符。\n"); document.userfrm.pass.focus(); return false; } else if(userpass != ruserpass){ alert("两次输入的密码不一致"); document.userfrm.rpass.select(); return false; } return true; } function bdaycheck(){ var bmonth = document.userfrm.bmon.value; var bday = document.userfrm.bday.value; var byear = document.userfrm.byear.value; if (bmonth == "" || bday == "" || byear == "" || bday == "dd" || byear == "yyyy") { alert("请输入您的生日"); document.userfrm.bmon.focus(); return false; } for (i = 0; i < bday.length; i++) { var bnum = bday.substring(i,i+1) if (!(bnum < 9 || bnum > 0)) { alert("日期无效"); document.userfrm.bday.focus(); return false; } } if(byear.substring(0,1)==2&&byear;.substring(1,2)==0) //年份必须以20打头 { for (j = 2; j < byear.length; j++) { var bynum = byear.substring(j,j+1); if (!(bynum < 9 || bynum > 0)) { alert("年份无效"); document.userfrm.byear.focus(); return false; } } } else { alert("年份必须以20打头"); return false; } if (byear < 1900 || byear > 2120) { alert("您输入的出生年份超出范围!\n请重新输入!"); document.userfrm.byear.focus(); return(false); } else if (bmonth < 0 || bmonth > 12) { alert("您输入的月份超出范围!\n请重新输入!"); document.userfrm.bmon.focus(); return(false); } else if (bday < 0 || bday > 31) { alert("您输入的日期超出范围!\n请重新输入!"); return(false); } return true; } [removed]
...展开收缩