码迷,mamicode.com
首页 > Web开发 > 详细

Jquery 复习练习

时间:2016-05-15 07:06:35      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

Jquery 复习练习

<input id="zhang" type="button" value="zhang" /><br />

  (function(w) { })(window);
        (function(w) {
            
            var getE= function(id) {

                return document.getElementById(id);
            }
            w.getE = getE;

        })(window);

        var a = getE("zhang").value;
        $("#zhang").bind("click", function(event) { alert(a);});
    </script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="jquery-1.8.3.js"></script>
</head>
<body>
<div id="divMsg">Hello World!</div>
<input id="btnShow" type="button" value="显示"/>
<input id="btnHide" type="button" value="隐藏"/><br/>
<input id="btnChange" type="button" value="修改内容为 Hello World, too!"/>
<div id="testDiv">测试图层</div>
<input id="btnzhaoren" type="button" value="zhaoren"/><br/>
    <input id="zhang" type="button" value="zhang" /><br />
    <script type="text/javascript">
        $("#btnShow").bind("click", function (event) { $("#divMsg").show(); });
        $("#btnHide").bind("click", function (event) { $("#divMsg").hide(); });
        $("#btnChange").bind("click", function (event) { $("#divMsg").html("我要杀了你!") });
        $("#btnHide").bind("click", function (event) { $("#testDiv").each(function () { $("#testDiv").html("谁是小三") }); });
        
        //$("#testDiv").each(function () { alert(this); });

        (function(w) { })(window);
        (function (w)
        {
            var tools={
                getE: function (id) { return document.getElementById(id); },
                iSIE: function(className) {}
            }

            w.t = tools;
        
        })(window);

        var a = t.getE("zhang").value;
        
        $("#zhang").bind("click", function(event) { alert(a);});
    </script>
</body>

</html>

 

Jquery 复习练习

标签:

原文地址:http://www.cnblogs.com/laopo/p/5494402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!