我正在尝试使用 Javascript 来显示/隐藏网页上的某个区域如何更改下面的代码以获得所需的结果。function yesNoCheck(marked) { var x = document.getElementById("myDIV"); if (marked) { x.style.display = "none"; } else { x.style.display = "block"; }}#myDIV { width: 50%; padding: 50px 0; text-align: center; background-color: lightblue; margin-top: 20px;}<input type="radio" name="employee" value="Yes" id="yes" onclick="yesNoCheck(true)" checked><label for="yes">Yes</label> <input type="radio" name="employee" value="No" id="no" onclick="yesNoCheck(false)"><label for="no">No</label> <br /> <br/><div id="myDIV"> This is my DIV element.</div>当我点击“是”时,我预计蓝色区域会消失。实际上,当我单击任一按钮时,什么也没有发生!
添加回答
举报
0/150
提交
取消