0
這個問題已經在stackoverflow中看到了很多次,並且有很多解決方案,但是設置它返回false,使用location.replace而不是location.href並不適用於我。你能幫看看有什麼在我的代碼的問題:Javascript location.replace無法正常工作
"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;
}
你'return'語句不在一個函數......這不是有效的 –
爲什麼是'回來了嗎?這不是一個功能。 –