<%@ page contentType="text/html; charset=GBK" language="java" errorPage=""%><html>
<head>
<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.question.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("密码长度不得少于6个字符,不得多于16个字符!");
return false;
}
return true;
}
function isEmpty(str){
if(str == null || str.length == 0)
return true;
else
return false;
}
</script>
<title>用户注册</title>
</head>
<body>
<form name="userRegisterForm" method="post" action="register.jsp" onsubmit="return checkForm(this);">
<head>
<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.question.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("密码长度不得少于6个字符,不得多于16个字符!");
return false;
}
return true;
}
function isEmpty(str){
if(str == null || str.length == 0)
return true;
else
return false;
}
</script>
<title>用户注册</title>
</head>
<body>
<form name="userRegisterForm" method="post" action="register.jsp" onsubmit="return checkForm(this);">
if(str == null || str.length == 0)
{
return true;
}
else
{
return false;
}
}
if(isEmpty(form.uid.value) || isEmpty(form.password.value) || isEmpty(form.confirmPassword.value) || isEmpty(form.email.value) || isEmpty(form.question.value) || isEmpty(form.answer.value))
就好了
<head>
<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.question.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("密码长度不得少于6个字符,不得多于16个字符!");
return false;
}
return true;
} function isEmpty(str){
if(str == null || str.length == 0)
return true;
else
return false;
}
</script>
<title>用户注册</title>
</head>
<body>
<form name="userRegisterForm" method="post" action="register.jsp" onsubmit="return checkForm(this);">
</body>
</html>