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

jQuery ?? - ???

??? ?? ??

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

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


first() ???

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

<!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","blue");
});
</script>
</head>
<body>
    <div>
        <p>段落1</p>
    </div>
    <div>
        <p>段落2</p>
    </div>
    <p>段落3</p>
</body>
</html>

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


last() ???

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

<!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","red");
});
</script>
</head>
<body>
    <div>
        <p>段落1</p>
    </div>
    <div>
        <p>段落2</p>
    </div>
    <p>段落3</p>
</body>
</html>

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


eq() ???

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

??? ??? 0?? ????? ? ?? ??? ??? ??? 1? ?? 0???.

<!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","green");
});
</script>
</head>
<body>
    <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>

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


filter() ???

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

<!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>
    <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>

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


not() ???

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

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

<!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","gray");
});
</script>
</head>
<body>
    <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>

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


???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("li").eq(-1).css({"color":"red","border":"2px solid blue"}) }) </script> </head> <body> <div> <ul> <li>HTML專(zhuān)區(qū)</li> <li>Javascript專(zhuān)區(qū)</li> <li>Div+Css專(zhuān)區(qū)</li> <li>Jquery專(zhuān)區(qū)</li> </ul> <p> eq 是負(fù)數(shù)的時(shí)候,從最后一個(gè)元素往回計(jì)數(shù)。</p> </div> </body> </html>