弹出div隐藏层

<style type="text/css">
    .div1{position:absolute;display:none;}
    .div2{position:absolute;display:none;}
</style>

 

 

 <div id="div1" class="div1">
                       隐藏层1
     </div>
     <div id="div2" class="div1">
                    隐藏层2
       <input type="button" value="btn2" id="btn2" onclick="div2Show()" />
    </div>
      <input type="button" value="btn1" id="btn1" onclick="div1Show()"/>

 

<script type="text/javascript">
        function div1Show() {
            var div1= document.getElementById("div1");
            div1.style.display = 'block';
        }
        function div2Show() {
            var div1= document.getElementById("div1");
            var div2= document.getElementById("div2");
            div1.style.display = 'none';
            div2.style.display = 'block';
        }
</script>

 

posted on 2015-10-09 14:31  静以修身!  阅读(547)  评论(0编辑  收藏  举报

导航