代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SGHregister</title>
<link rel="icon" href="./img/logo.ico">
<style>
body {
overflow: hidden;
background-color: #F2D9E6;
}
form {
width: 80vw;
margin: 200px auto;
border: 1px solid #000;
/* padding: 20px; */
text-align: center;
}
form div {
margin: 20px auto;
}
form label {
width: 100px;
display: inline-block;
text-align: right;
}
.btn {
padding: 5px 25px;
}
h2>a {
font-size: 14px;
/* vertical-align: bottom; */
}
</style>
</head>
<body>
<form action="#" id="register">
<h2>注册
<a href="./login.html">登录</a>
</h2>
<div>
<label for="account">
账号:
</label>
<input type="text" id="username" name="username">
</div>
<div>
<label for="password">密码:</label>
<input type="password" id="password" name="password">
</div>
<div>
<label for="rePassword">确认密码:</label>
<input type="password" id="rePassword" name="rePassword">
</div>
<!-- <div>
<label for="account">
激活码:
</label>
<input type="text" name="act" value="123456789">
</div> -->
<div>
<label for=""></label>
<input class="btn" type="submit" value="注册" id="register-btn">
<input class="btn" type="reset" value="重置">
</div>
</form>
<script src="./js/ajax.js"></script>
<script src="./js/cookie.js"></script>
<script>
// appkey=Q_A_Q_1590927055348
var submitBtn = document.getElementById('register-btn');
submitBtn.onclick = function (e) {
e.preventDefault();
var form = document.getElementById('register');
var username = form.username.value;
var password = form.password.value;
var rePassword = form.rePassword.value;
var act = "123456789";
// var act = form.act.value;
// if (act != "123456789") {
// alert("激活码不正确");
// return false;
// }
if (username && password && rePassword) {
if (password == rePassword) {
var data = 'appkey=2018211483_1590670341250&account=' + username + '&password=' + password +
'&rePassword=' + rePassword + '&username=' + username;
ajax('POST', 'http://open.duyiedu.com/api/student/stuRegister', data, function (result) {
if (result.status == 'success') {
alert('注册成功');
location.href = './login.html'
} else {
alert(result.msg);
}
}, true);
} else {
alert("密码前后不一致");
}
} else {
alert("请完善信息!");
}
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。