求助,为什么无法检测
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>login</title>
<link rel="stylesheet" href="../css/login.css">
<script type="text/javascript">
function validateRegEx(regex, input, helpText, help){
if(!regex.test(input)){
if(helpText!=null)
helpText.innerHTML=help;
return false;
}
else{
if(helpText!=null)
helpText.innerHTML="";
return true;
}
}
function validateLength(minLength, maxLength, inputField, helpText){
if(validateRegEx(new RegExp("^.{" + minLength + "," + maxLength + "}$"), inputField.value, helpText, "请依照正确长度输入!"))
validateRegEx(/^.[A-Za-z0-9]+$/, inputField.value, helpText, "有非法字符!")
}
function placeOrder(form){
if(validateLength(1, 16, form["userName"], form["nameError"])&&)
form.submit();
else
alert("请检查输入的内容");
}
</script>
</head>
<body onload="document.getElementById('userName').focus()">
<div id="interFace">
<div id="title"><span>登录</span></div>
<form action="../php/login.php" method="post" name="loginForm">
<div class="tableRow">
<label for="userName">用户名:</label>
<input type="text" id="userName" name="userName" onblur="validateLength(1, 16, this, document.getElementById('nameError'))" placeholder="请按正确格式输入">
<span id="nameError"></span>
</div>
<div class="tableRow">
<label for="userPassword">密码:</label>
<input type="password" id="userPassword" name="userPassword">
<span id="passwordError"></span>
</div>
<div class="tableRow" id="btn">
<input type="submit" value="登录" onclick="placeOrder(this.form);">
<span id="formError"></span>
</div>
</form>
</div>
</body>
</html>
求助,为什么没法输出检测结果?我觉得没有地方错啊