<script type="text/javascript">
function check() {
if (document.add_admin.username.value=="") {
alert("请输入用户名!");
document.add_admin.username.focus();
return false;
}
if (document.add_admin.username.value.length < 6) {
alert("用户名不得少于6位!");
document.add_admin.username.focus();
return false;
}
if (document.add_admin.password1.value=="") {
alert("请输入密码!");
document.add_admin.password1.focus();
return false;
}
if (document.add_admin.password2.value=="") {
alert("请输入再次确认密码!");
document.add_admin.password2.focus();
return false;
}
if (document.add_admin.password1.value <> document.add_admin.password2.value) {
alert("两次密码不一致!");
document.add_admin.password2.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form id="add_admin" action="add_admin_do.asp" method="post" onsubmit="return check()">
<dl>
<dd>用 户 名:<input type="text" class="text" name="username" /></dd>
<dd>密 码:<input type="text" class="text" name="password1" /></dd>
<dd>确认密码:<input type="text" class="text" name="password2" /></dd>
<dd><input type="submit" name="send" class="submit" value="添加" /><input type="reset" class="submit" value="重置" /></dd>
</dl>
</form>
</body>
</html>
function check() {
if (document.add_admin.username.value=="") {
alert("请输入用户名!");
document.add_admin.username.focus();
return false;
}
if (document.add_admin.username.value.length < 6) {
alert("用户名不得少于6位!");
document.add_admin.username.focus();
return false;
}
if (document.add_admin.password1.value=="") {
alert("请输入密码!");
document.add_admin.password1.focus();
return false;
}
if (document.add_admin.password2.value=="") {
alert("请输入再次确认密码!");
document.add_admin.password2.focus();
return false;
}
if (document.add_admin.password1.value <> document.add_admin.password2.value) {
alert("两次密码不一致!");
document.add_admin.password2.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form id="add_admin" action="add_admin_do.asp" method="post" onsubmit="return check()">
<dl>
<dd>用 户 名:<input type="text" class="text" name="username" /></dd>
<dd>密 码:<input type="text" class="text" name="password1" /></dd>
<dd>确认密码:<input type="text" class="text" name="password2" /></dd>
<dd><input type="submit" name="send" class="submit" value="添加" /><input type="reset" class="submit" value="重置" /></dd>
</dl>
</form>
</body>
</html>