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("FAIL");
return false;
}
}
<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">Login</button>
</div>
</form>
</div>
The login-window just refresh after submit.
And I tried "window.open("TXL.html", '_self');"
and it doesn't work,even can't open the new window.
I also tried window.location.href=""; ,it still doesn't work.
Thanks for reading!