Html/JS实现页面的折叠

<html>

<head>

<title>Js页面折叠</title>

</head>

<script type="text/javascript" language="javascript">
                        var show = false;
                        function ShowQueryOption()
                         {
                            var divQueryOptionUserControl = document.getElementById("MainComment");
                            var imgShow = document.getElementById("ShowComment");
                            if (show) {
                                divQueryOptionUserControl.style.display = "none";
                                show = false;
                                imgShow.src = "../Img/Plus.gif";
                            }
                            else
                             {
                                divQueryOptionUserControl.style.display = "";
                                show = true;
                                imgShow.src = "../Img/Minus.gif";
                            }
                        }
                    </script>

<body>

<div>

  <img  alt="" src="../Img/Plus.gif" id="ShowComment" onmouseover="this.style.cursor='hand'" onclick="ShowQueryOption();" />Application Comment:</div>

<div id="MainComment" runat="server"  style="display: none">

<div>1</div>

<div>2</div>

<div>需要折叠的内容</div>

</div>


</body>

</html>



猜你喜欢

转载自blog.csdn.net/qq_26979325/article/details/51353998