<html>
<head>
    <title>无标题页</title>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("button").click(function () {
                $("p").slideToggle("slow"); 
            });
        });
    </script>
</head>
<body>
    <button type="button">Hide</button>
    <p>
        This is a paragraph with little content.</p>
    <p>
        This is another small paragraph.</p>
</body>
</html>我要写一个什么 方法能<p>LODE的时候就隐藏呢?
如果P不隐藏的话我这方法跟吗写一样 - - 请高手解决一下

解决方案 »

  1.   

    这个意思吗?<html>
    <head>
        <title>无标题页</title>   
        <script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $("p").hide();            $("button").click(function() {
                
                    $("p").show().slideToggle("slow");
                });
            });
        </script>
    </head>
    <body>
        <button type="button">Hide</button>
        <p>
            This is a paragraph with little content.</p>
        <p>
            This is another small paragraph.</p>
    </body>
    </html>
      

  2.   

    初始化的时候要让<p>
            This is a paragraph with little content.</p>隐藏起来当我点按钮的时候在显示(如果再点就在隐藏)
      

  3.   


    <html>
    <head>
        <title>无标题页</title>    <script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('p').hide();
                $("button").click(function() {
                    $("p").slideToggle("slow");
                });
            });
        </script>
    </head>
    <body>
        <button type="button">Hide</button>
        <p>
            This is a paragraph with little content.</p>
        <p>
            This is another small paragraph.</p>
    </body>
    </html>
      

  4.   


    我还以为要什么啊。。slideToggle就是如果元素隐藏就显示反之也一样那你就把P元素在初始设成一个display:none;就行了5楼是一种但下面这样写就行。。
    <html>
    <head>
        <title>无标题页</title>    <script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {           
                $("button").click(function() {
                    $("p").slideToggle("slow");
                });
            });
        </script>
    </head>
    <body>
        <button type="button">Hide</button>
        <p style="display:none">
            This is a paragraph with little content.</p>
        <p style="display:none">
            This is another small paragraph.</p>
    </body>
    </html>