50,530
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<script type="text/javascript">
function save(){
var username = document.getElementById("username").value;
var password = document.getElementById("userpass").value;
if(username == '' || username == null){
alert("用户名不能为空!");
return;
}
if(password == '' || password == null){
alert("密码不能为空!");
return;
}
var reg = /^[A-Z](?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]{7,15})$/g;
var checkPass = reg.test(password);
if(checkPass){
alert("密码由数字和字母组成,开头必须.....");
return;
}
document.biaodan.submit();
}
</script>
<body>
<form name="biaodan" id="subForm" method="post" action="1.html">
<div>
用户名:<input type="text" name="ming" id="username"/><br>
密 码:<input type="password" name="mi" id="userpass"/><br>
<input type="button" name="zhuce" value="提交" id="sub" onclick="save();"/>
<input type="reset" name="zhuce" value="重置" />
</div>
</form>
</body>
</html>