我已經使用javascript消失了表單,但是現在我希望在窗體顯示爲無時顯示一行文本,而且我不確定JavaScript的正確布爾運算符是什麼是。使用javascript隱藏和顯示元素
<script>
function Enter() {
survey.style.display = "none";
if (survey==="none"){
thank.style.display = "inline";
}
else {
thank.style.display = "none";
}
}
</script>
<div id="right">
<div id="thank" style=" display: none">
Thank you, your message has been sent.
</div>
<form name="survey" id="survey" action="" method="post">
<input type="submit" value="Contact Us!" onclick="Enter()"/>
</form>
</div>
錯誤消息:
"message": "SyntaxError: expected expression, got '<'", "filename": " https://stacksnippets.net/js ", "lineno": 13, "colno": 28
可能是你應該嘗試,如果(survey.style.display =='none'){ thank.style.display ='inline'; } – Gunnrryy
嘗試使用雙等於? '=='而不是'==='? –
@PraveenKumar問題在於我的JDK表示它期望'===' – briggleshiggle