`
Mr.Zero
  • 浏览: 33447 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

JQuery显示和影藏DIV

 
阅读更多
<!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>  
        <meta http-equiv="Content-Type" content="text/html; charset=gbk" />  
        <title>StripingTable</title>  
        <script type="text/javascript" src="http://www.wozaishuo.com.cn/example/jquery/jquery-1.2.1.js"></script>  
        <script type="text/javascript">  
        <!--   
            $(document).ready(function(){ });   
               
            //隐藏和显示div层   
            function changeDisplay(){   
                var helloDivObj = $("#helloDiv");   
                var buttonObj = $("#btnDisplay");   
                var val = buttonObj.attr("value");   
                if(val=="隐藏"){   
                    helloDivObj.hide();   
                    buttonObj.attr("value","显示");   
                }else{   
                    helloDivObj.show();   
                    buttonObj.attr("value","隐藏");   
                }   
                          // var helloDivObj = $("#helloDiv").toggle(); //甚至只需要这一句搞定切换隐藏与显示               
    }   
        -->  
        </script>  
    </head>  
    <body>  
        <div class="title_a">一、JQuery核心库</div>  
        <div class="title_b">(一)、jQuery(e-xpression,[context])用法!</div>  
        <div class="title_c">3.jQuery(elements)</div>  
        将一个或多个DOM元素转化为jQuery对象。这个函数也可以接收XML文档和Window对象(虽然它们不是DOM元素)作为有效的参数。<p></p>  
           
        <input id="btnDisplay" type="button" value="隐藏" onclick="changeDisplay()"/>  
        <div id="helloDiv">  
        Hello,everyone<p></p>  
        Hello,everytwo<p></p>  
        Hello,everythree<p></p>  
        </div>  
    </bdoy>  
</html>  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics