以下为引用的内容: <p> <input id='control' value="想要隐藏的控件"> </p> <p> |
隐藏上面的控件,并使其不占用页面上的位置
以下为引用的内容: <input type="button" value='隐藏' onclick='displayHide_control()'> <input type="button" value='显示' onclick='displayShow_control()'> <br /> |
仅仅隐藏控件,其位置仍然占用
以下为引用的内容: <input type="button" value='隐藏' onclick='visibilityHide_control()'> <input type="button" value='显示' onclick='visibilityShow_control()'> </p> <script language="javascript" type="text/javascript"> function displayHide_control() { var _control = document.getElementById("control"); _control.style.display="none"; } function displayShow_control() { var _control = document.getElementById("control"); _control.style.display="block"; } function visibilityHide_control() { var _control = document.getElementById("control"); _control.style.visibility="hidden"; } function visibilityShow_control() { var _control = document.getElementById("control"); _control.style.visibility="visible"; } </script> |