0
當我按下按鈕並使元素出現時,然後按另一個元素並使另一個元素出現,但它不起作用。我當前的代碼是這樣的:某些元素不會被更改,即使它們應該是
function login() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username == "Ethan" && password == "Horton") {
document.getElementById("test").innerHTML = "Logged In: Ethan";
document.getElementById("p1").style.visibility = "hidden";
document.getElementById("Logout").style.visibility = "visible";
} else if (username == "Person" && password == "Password") {
document.getElementById("test").innerHTML = "Logged In: Person";
document.getElementById("p1").style.visibility = "hidden";
document.getElementById("p1").style.visibility = "hidden";
document.getElementById("Logout").style.visibility = "visible";
} else {
alert("Incorrect User/Pass");
}
}
正如你所看到的,我需要改變相當多的東西,但它不會這麼做。幫幫我?
演示這裏:http://jsfiddle.net/dX28k/
請提供更多的情況下,證明該問題等可能包含一個演示。 – PSL
添加了演示。審查它,請幫助。 – Durnehviir
檢查這個小提琴可能是你正在尋找http://jsfiddle.net/szUnC/。也請在問題中解釋你想要什麼,你嘗試過什麼,你的問題是什麼。 – PSL