eq, ne 等于、不等于
gt, ge 大于、大于等于
lt, le 小于、小于等于
01
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
02 <html xmlns= “http://www.w3.org/1999/xhtml” >
03 <head>
04 <meta http-equiv= “Content-Type” content= “text/html; charset=gb2312″ />
05 <title>Hello Lazynight! </title>
06 <script type= “text/javascript” src= “jquery-1.1.3.pack.js” ></script>
07 <script type= “text/javascript” >
08 $( document ). ready( function (){
09 alert( “eq=” + $( “p” ). eq( 1 ). text());
10 //取得第二个P内字段,结果为22222
11 alert( “gt=” + $( “p:gt(1)” ). text());
12 //将3,4,5号p字段连续输出,结果为333334444455555
13 alert( “lt=” + $( “p:lt(2)” ). text());
14 //将1,2号字段连续输出,结果为1111122222
15 });
16 </script>
17 </head>
18 <body>
19 <p>11111 </p>//一号字段
20 <p>22222 </p>//二号字段
21 <p>33333 </p>//三号字段
22 <p>44444 </p>//四号字段
23 <p>55555. </p>//五号字段
24 <pre>
25 其实简单的说因为所有jQuery的select(选择器)返回的是一个数组。
26 你可认为
27 是得到这个数组的第几个元素。
28 注意是从0开始的。
29 </pre>
30 </body>
31 </html>
02 <html xmlns= “http://www.w3.org/1999/xhtml” >
03 <head>
04 <meta http-equiv= “Content-Type” content= “text/html; charset=gb2312″ />
05 <title>Hello Lazynight! </title>
06 <script type= “text/javascript” src= “jquery-1.1.3.pack.js” ></script>
07 <script type= “text/javascript” >
08 $( document ). ready( function (){
09 alert( “eq=” + $( “p” ). eq( 1 ). text());
10 //取得第二个P内字段,结果为22222
11 alert( “gt=” + $( “p:gt(1)” ). text());
12 //将3,4,5号p字段连续输出,结果为333334444455555
13 alert( “lt=” + $( “p:lt(2)” ). text());
14 //将1,2号字段连续输出,结果为1111122222
15 });
16 </script>
17 </head>
18 <body>
19 <p>11111 </p>//一号字段
20 <p>22222 </p>//二号字段
21 <p>33333 </p>//三号字段
22 <p>44444 </p>//四号字段
23 <p>55555. </p>//五号字段
24 <pre>
25 其实简单的说因为所有jQuery的select(选择器)返回的是一个数组。
26 你可认为
27 是得到这个数组的第几个元素。
28 注意是从0开始的。
29 </pre>
30 </body>
31 </html>