六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 134|回复: 0

JQuery显示隐藏DIV (一)

[复制链接]

升级  36.67%

25

主题

25

主题

25

主题

秀才

Rank: 2

积分
105
 楼主| 发表于 2013-2-7 20:36:21 | 显示全部楼层 |阅读模式
<!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="隐藏" />        <div id="helloDiv">        Hello,everyone<p></p>        Hello,everytwo<p></p>        Hello,everythree<p></p>        </div>    </bdoy></html> 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表