标签:
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>
标签:
原文地址:http://www.cnblogs.com/laopo/p/5494402.html