由於某些原因,這不會使「errorJS」div可見。有人可以幫幫我嗎?使用Javascript更改CSS屬性
function checkLogin()
{
document.getElementById("errors").style.display = "none";
var form = document.getElementById("form1");
var problems = false;
document.getElementById("errorJS").innerHTML = "";
if(form.email.value.length < 1)
{
document.getElementById("errorJS").innerHTML += "Please enter your email address. <br />";
problems = true;
document.getElementById("errorJS").style.display = "box";
}
if(form.pword.value.length < 1)
{
document.getElementById("errorJS").innerHTML += "Please enter your password.";
problems = true;
alert(document.getElementById("errorJS").style.display);
document.getElementById("errorJS").style.display = "box";
}
return !(problems);
}
愚蠢的我,我不敢相信我犯了那個錯誤。我一直在編碼更多的連續小時。感謝所有的答案。