亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery ???

jQuery Traversal - Filter

?? ?? ??? ??

?? ???? ? ?? ??? ??? first(), last() ? eq()???. ?? ??? ???? ?? ?? ?? ?????.

filter() ? not()? ?? ?? ??? ??? ???? ??? ??? ????? ???? ?? ??? ??? ? ????.


jQuery first() ???

first() ???? ??? ?? ? ? ?? ??? ?????.

?? ???? ? ?? <div> ?? ?? ? ?? <p> ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("div p").first().css("background-color","yellow");
});
</script>
</head>
<body>
<h1>歡迎訪問我的主頁</h1>
<div>
<p>這是 div 中的一個(gè)段落。</p>
</div>
<div>
<p>這是另外一個(gè) div 中的一個(gè)段落。</p>
</div>
<p>這是一個(gè)段落。</p>
</body>
</html>

????? ???? ??? ???.


jQuery last() ???

last() ???? ?????. ??? ??? ??? ?????.

?? ???? ??? <div> ???? ??? <p> ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("div p").last().css("background-color","yellow");
});
</script>
</head>
<body>
<h1>歡迎訪問我的主頁</h1>
<div>
<p>這是 div 中的一個(gè)段落。</p>
</div>
<div>
<p>這是另外一個(gè) div 中的一個(gè)段落。</p>
</div>
<p>這是一個(gè)段落。</p>
</body>
</html>

????? ???? ??? ???.


jQuery eq() ???

eq() ???? ?????. ??? ??? ??? ?? ??? ?????.

??? ??? 0?? ????? ? ?? ??? ??? ??? 1? ?? 0???. ?? ???? ? ?? <p> ??(?? 1)? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("p").eq(1).css("background-color","yellow");
});
</script>
</head>
<body>
<h1>歡迎訪問我的主頁</h1>
<p>php中文網(wǎng) (index 0).</p>
<p>http://ipnx.cn (index 1)。</p>
<p>google (index 2).</p>
<p>http://www.google.com (index 3)。</p>
</body>
</html>

????? ???? ??? ???


jQuery filter() ???

filter() ???? ???? ??? ??? ? ????. . ? ??? ???? ?? ??? ????? ???? ???? ??? ?????.

?? ???? ??? ??? "url"? ?? <p> ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
   $("p").filter(".url").css("background-color","yellow");
});
</script>
</head>
<body>
<h1>歡迎訪問我的主頁</h1>
<p>php中文網(wǎng) (index 0).</p>
<p class="url">http://ipnx.cn (index 1)。</p>
<p>google (index 2).</p>
<p class="url">http://www.google.com (index 3)。</p>
</body>
</html>

????? ???? ??? ???


jQuery not() ???

not() ???? ??? ???? ?? ?? ??? ???????.

?: not() ???? filter()? ?????.

?? ???? ??? ?? "url"? ?? ?? <p> ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
   $("p").not(".url").css("background-color","yellow");
});
</script>
</head>
<body>
<h1>歡迎訪問我的主頁</h1>
<p>php中文網(wǎng) (index 0).</p>
<p class="url">http://ipnx.cn (index 1)。</p>
<p>google (index 2).</p>
<p class="url">http://www.google.com (index 3)。</p>
</body>
</html>

????? ???? ??? ???



???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("div p").first().css("background-color","yellow"); }); </script> </head> <body> <h1>歡迎訪問我的主頁</h1> <div> <p>這是 div 中的一個(gè)段落。</p> </div> <div> <p>這是另外一個(gè) div 中的一個(gè)段落。</p> </div> <p>這是一個(gè)段落。</p> </body> </html>