使用javascript隐藏和显示元素

使用javascript隐藏和显示元素,javascript,Javascript,我已经用javascript使我的表单消失了,但是现在我想在表单显示为无时显示一行文本,我不确定javascript的正确布尔运算符是什么 <script> function Enter() { survey.style.display = "none"; if (survey.style.display==

我已经用javascript使我的表单消失了,但是现在我想在表单显示为无时显示一行文本,我不确定javascript的正确布尔运算符是什么

                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>

函数Enter(){
survey.style.display=“无”;
如果(调查==“无”){
thank.style.display=“inline”;
}
否则{
thank.style.display=“无”;
}
}

谢谢,您的信息已经发送。

如果我正确理解你

                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>
您希望有一行默认的tekst wich:“显示:无” 因此:

                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>

我的tekst系列

                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>
结合您的脚本:

<script>
function Enter() {
    survey.style.display = "none";

    if (survey==="none"){
        thank.style.display = "inline";
        document.getElementById("MyTekst").style.display = "block";
    }
    else {
       thank.style.display = "none";
    }
}
</script>
                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>

函数Enter(){
survey.style.display=“无”;
如果(调查==“无”){
thank.style.display=“inline”;
document.getElementById(“MyTekst”).style.display=“block”;
}
否则{
thank.style.display=“无”;
}
}

让我们知道它是否有助于

让它与此一起工作:

                   <script>

                    function Enter() {
                        survey.style.display = "none";

                        if (survey.style.display==="none"){
                            thank.style.display = "inline";
                        }
                    }
                </script>

函数Enter(){
survey.style.display=“无”;
if(survey.style.display==“无”){
thank.style.display=“inline”;
}
}

如果(survey.style.display='none'){thank.style.display='inline';}尝试使用双相等,您可能应该尝试一下
=
而不是
==
?@PraveenKumar问题是我的JDK说它期望
==
@briggleshiggle为什么不试试看呢?它是阻止您运行还是什么?您是否可以添加一些“调试检查点”console.log(“Checkpoint x”);“以获取一些调试信息?一旦表单消失,仍然无法显示文本行。