<div class="modal-body">
<form action="" class="form center-block" onsubmit="login()">
<div class="form-group">
<input type="text" id="username" class="form-control input-lg" placeholder="请输入用户名">
</div>
<div class="form-group">
<input type="password" id="password" class="form-control input-lg" placeholder="请输入密码">
</div>
<div class="form-group">
<button class="btn btn-primary btn-lg btn-block" type="submit">登录</button>
</div>
</form>
</div>
<script type="text/javascript">
function login() {
var un = document.getElementById("username").value;
var pw = document.getElementById("password").value;
if (un == "admin" && pw == "admin") {
window.open("TXL.html", '_blank');
this.window.close();
return true;
}
else {
alert("登录失败");
return false;
}
}
</script>
1 回答
已采纳
Caballarii
TA贡献1123条经验 获得超629个赞
window.open和window.close都会有被浏览器拦截的可能性
建议直接用window.location.href="TXL.html"代替
window.open("TXL.html", '_blank');
this.window.close();
这两行
添加回答
举报
0/150
提交
取消