document.getElementsByTagName("div")obj.currentStyle.position=="absolute"||obj.currentStyle.position=="relative"obj.style.visibility="hidden"

解决方案 »

  1.   

    简单 <body style="display: none">
      

  2.   

    黄容的方法是不是把body里的所有元素都隐藏了??
      

  3.   

    function hidden(divName)
    {
    divName.style.display = 'none';
    }<div style="display:''" id="key">
    所有要隐藏的东西
    </div>
    <input type="button" onClick="javascript:hidden(key)">
      

  4.   

    <script language="JavaScript" type="text/JavaScript">
    function test()
    {
    var divs = document.getElementsByTagName("div")
    for(i=0;i<divs.length;i++)
    divs[i].style.display="none"
    }
    </script>
    <input type="button" name="Button" value="Button" onClick="test()">
    <div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; background-color: #FF0000; layer-background-color: #FF0000; border: 1px none #000000;">1111111111111111</div>
    <div id="Layer2" style="position:absolute; width:200px; height:115px; z-index:2; left: 407px; top: 21px; background-color: #0000CC; layer-background-color: #0000CC; border: 1px none #000000;">2222222</div>
    <div id="Layer3" style="position:absolute; width:200px; height:115px; z-index:3; left: 150px; top: 219px; background-color: #009900; layer-background-color: #009900; border: 1px none #000000;">2222</div>