注册登录校检
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册</title>
<script language="javascript">
//javascript check函数,用于检查表单中输入的用户昵称和登录密码是否为空
function check()
{
if(document.frm.userName.value=='')
{
alert("您的账号不能为空!");
document.frm.userName.focus();
return false;
}
else if(document.frm.userPassword.value=='')
{
alert("您的登录密码不能为空");
document.frm.userPassword.focus();
return false;
}
else if(document.frm.userPassword.value!=document.frm.userPassword1.value)
{
alert("对不起,您的两次密码不一致");
document.frm.yanzheng.focus();
return false;
}
else if(document.frm.email.value=='')
{
alert("对不起,您的邮箱不能为空");
document.frm.yanzheng.focus();
return false;
}
else if(document.frm.qq.value=='')
{
alert("对不起,您的qq不能为空");
document.frm.yanzheng.focus();
return false;
}
else{
return true;
}
}
</script>
</script>
</head>
<body>
<h1>注册</h1>
<div class="banner">
<form action="#" method="post" name="frm" οnclick="return check();">
<input type="text" value="用户名" maxlength="100" name="userName" >
<br />
<input type="password" value="输入密码" maxlength="100" name="userPassword" >
<br />
<input type="password" value="重复密码" maxlength="100"
name="userPassword1" >
<br />
<input type="text" value="邮箱" maxlength="100" name="email" >
<br />
<input type="text" value="QQ" maxlength="100" name="qq" >
<br />
<input type="submit" value="提交">
</form>
</body>
</html>