<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
  $("p").hide(1000);
  });
});
</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>
我想判断一下我点这个按钮的时候他是隐藏我就 show  他是显示我就 hide高手帮帮忙啊..

解决方案 »

  1.   

    最好是可以实现:有2个DIV点上面的下面的隐藏(如果隐藏就显示)..
    静静等待佳音.
      

  2.   

    哈哈这个是JQUERY的教程里的例子。
    不过似乎没从隐藏到显示的例子都隐藏了还怎么点呢
      

  3.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>无标题页</title>    <script type="text/javascript" src="jquery-1.4.2.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>
      

  4.   


    按照你的这个写了但是他说找不到JS文件!!! 难道
     <script type="text/javascript">
        $(document).ready(function(){
              $("button").click(function()
              {
                $("p").slideToggle("slow"); //这句改成这样就可以了
              });
        });
        </script>
    得放到JS文件里?
      

  5.   

    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    这个是调用什么哦 ?请赐教
      

  6.   

    哦,不好意思,你引用的JQuery库是:
    <script type="text/javascript" src="/jquery/jquery.js"></script>
    我的是:
    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    ,这段js代码改成你自己的就行了,即
    <script type="text/javascript" src="/jquery/jquery.js"></script>
      

  7.   

    当该Html文档从上而下解析的时候,遇到<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    那么浏览器会加载这个js文件,然后继续向下解析Html代码
      

  8.   

    $("#id").toggle()切换可见状态。