点击一个按钮时下面弹出一个层,在点时层就收起来。最好是jquery代码实现。

解决方案 »

  1.   

    先把要显示的层做好 初始化的时候隐藏
    调用的时候再显示
    btn.onclick=function(){
     document.getElementById("div1").style.display="";
    }
      

  2.   

    这不就是手风琴效果!网上多的是,要实现这种效果,你写得html代码就要有一定的规律。不要老总是想要现成的,有时候多想象,多查查,不懂的也懂了!http://download.csdn.net/source/2036848
    自己下.......
      

  3.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>    <script src="../publ/JS/jquery-1.3.min.js" type="text/javascript"></script>
        <script>
            $(document).ready(function() { });
            function hiden() {
                $("#divObj").hide();
            }
            function show() {
                $("#divObj").show(); //显示,参数说明同上
            }    </script></head>
    <body>
        <form id="form1" runat="server">
        <input type="button" value="隐藏" onclick="hiden()"  />
        <input type="button" value="显示" onclick="show()" />
        <div id="divObj" style="display:none;">
            hello world!</div>
        </form>
    </body>
    </html>
      

  4.   


    <script type="text/javascript"> 
    function display(div){$(div).style.display=($(div).style.display=="none")?"":"none";} function $(obj){return document.getElementById(obj);} </script> 
      

  5.   

    也可以一个按钮解决,如:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
        <script src="../publ/JS/jquery-1.3.min.js" type="text/javascript"></script>
            <script>
                $(document).ready(function() {
                    $("#Button1").click(function() {
                        if ($(this).val() == "显示") {
                            $("#divObj").show();
                            $(this).val("隐藏");
                        }
                        else {
                            $("#divObj").hide();
                            $(this).val("显示");
                        }
                    })
                })
        </script>    
    </head>
    <body>
        <form id="form1" runat="server">
        <input id="Button1" type="button" value="显示" />
        <div id="divObj" style="display:none;"> hello world!</div>
        </form>
    </body>
    </html>
      

  6.   

    $(document).ready(function()  
    {  
      $("#btnShow").toggle(
      function () {
      $(("#divContent").addClass("hideClass");
      },
      function () {
      $(("#divContent").removeClass("hideClass");
      }
      );  
    });  
    或jquery hide() & show()