jsp:
<script type="text/javascript">
function check(){
var userName = document.getElementById("name").value;
var pass1 = document.getElementById("pass1").value;
var pass2 = document.getElementById("pass2").value;
var email = document.getElementById("email").value;
if(userName == ""|| pass1 == ""|| pass2 == ""|| email == ""){
alert("请将登录信息填写完整");
return false;
}
}
</script>
<form action="#" method="post" onsubmit="return check();" />
<input type="text" name="user.name" id="pass1" />
<input type="password" name="user.pass" id="pass2" />
<input type="password" id="name">
<input type="text" name="user.email" id="email" />
<input type="reset" value="重置" />
<input type="submit" value="注册" />
</form>
if(userName.length<15||userName.length>3){
pName.innerHTML = "";
return false;
}
看demo:
时间: 2024-10-31 11:59:03