`

一个低级错误~

阅读更多

<script language="javascript">
function checkForm(form){
    if(isEmpty(form.uid.value)||isEmpty(form.password.value)||isEmpty(form.confirmPassword.value)||isEmpty(form.email.value)||isEmpty(form.quesstion.value)||isEmpty(form.answer.value)||){
        alert("请将表单信息填写完整!");
        return false;
    }
    if(form.password.value!=form.confirmPassword.value){
        alert("两次密码不相同!");
        return false;
    }
    if(form.password.value.length<6||form.password.value.length>16){
        alert("密码长度不合法!");
        return false;
    }
    return true;
}
function isEmpty(str){
if(str=null||str.length==0)return true;
else return false;
}

</script>

扣错!

错在

if(isEmpty(form.uid.value)||isEmpty(form.password.value)||isEmpty(form.confirmPassword.value)||isEmpty(form.email.value)||isEmpty(form.quesstion.value)||isEmpty(form.answer.value)||){
这里错了:isEmpty(form.answer.value)||){

意思就是无论如何都是会返回一个true的!

怪不得我在form表单里添加这个函数没作用,哎,以后还是小心为好啊!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics