1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>无标题文档</title>
6 <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
7 <script>
8
9
10 $(function(){
11
12 //$('div').find('h3').eq(2).css('background','red');
13
14 /*var oDiv = $('div');
15 var aH3 = oDiv.find('h3');
16 var oH3_2 = aH3.eq(2);
17 oH3_2.css('background','red');*/
18
19 $('div').find('h3').eq(2).css('background','red').end().eq(4).css('background','green').end().end().css('border','1px red solid');
20 //事件绑定
21 $('.txt').bind('focus',{msg1:'I am msg1',msg2:'我是msg 2'},function(e){
22 $('#divTip').show().html(e.data.msg1);
23 });
24 });
25
26 </script>
27 </head>
28
29 <body>
30 <div>
31 <h3>11111</h3>
32 <h3>22222</h3>
33 <h3>33333</h3>
34 <h3>44444</h3>
35 <h3>55555</h3>
36 </div>
37
38 <div>姓名:<input type="text" class="txt" /></div>
39 <div id="divTip" class="clsTip"></div>
40 </body>
41 </html>