[英]javascript onclick=“location.replace('url')” not working
[英]Javascript location.replace not working
这个问题在stackoverflow中已经被看到很多次了,并且有很多解决方案,但是使用location.replace而不是location.href将它设置为false会对我不起作用。 您能帮我看看我的代码有什么问题吗:
"use strict";
var pass = document.getElementById("password").value, repass = document.getElementById("repassword").value;
if (pass !== repass) {
window.alert("password does not match!");
return true;
} else {
window.alert("Thank You,\nYou have successfully registered.");
window.location.replace("Login.html");
return false;
}
您可以只做window.location = '/Login.html'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.