天天看點

jquery的位置選擇器一

1銆佷唬鐮?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<title>jquery鐨勪綅缃€夋嫨鍣ㄤ竴</title>
		<!--寮曞叆jquery渚濊禆鍖?->
		<script type="text/javascript" src="../jquery-1.11.3.js"></script>
		<script type="text/javascript">
			$(function() {
				//:first瀛愬厓绱犺繃婊ら€夋嫨鍣?				//li:first杩斿洖椤甸潰鐨勬渶鍏堢殑li椤?				//$("li:first").css("color","#f00");
				
				//:last瀛愬厓绱犺繃婊ら€夋嫨鍣?				//li:last杩斿洖椤甸潰鐨勬渶鍚庣殑li椤?				//$("li:last").css("color","#f00");
				
				//:first-child瀛愬厓绱犺繃婊ら€夋嫨鍣?				//li:first-child杩斿洖姣忎釜鍒楄〃鐨勬渶鍏堢殑椤?				//$("li:first-child").css("color","#f00");
				
				//:last-child瀛愬厓绱犺繃婊ら€夋嫨鍣?				//li:last-child杩斿洖姣忎釜鍒楄〃鐨勬渶鍚庣殑椤?				//$("li:last-child").css("color","#f00");
				
				//鑾峰彇娌℃湁鍏勫紵鑺傜偣鐨?lt;a>鏍囩
				//$("a:only-child").css("color","#f00");
			});
		</script>
	</head>
	<body>
		<ul class="myList">
			<li>
				<a href="http://jquery.com" target="_blank" rel="external nofollow" >JQuery site</a>
				<ul>
					<li><a href="css1.txt" target="_blank" rel="external nofollow"  title="mycss">CSS1</a></li>
					<li id="tt"><a href="css2.pdf" target="_blank" rel="external nofollow"  title="css2">CSS2</a></li>
					<li><a href="css3.html" target="_blank" rel="external nofollow"  title="this is my">CSS3</a></li>
					<li>Basic XPath</li>
				</ul>
			</li>	
			<li>
				JQuery also supports
				<ul>
					<li>Custom selectors</li>
					<li>Form selectors</li>
				</ul>
			</li>		
		</ul>
	</body>
</html>
           

2銆佹渚?

jquery的位置選擇器一

3銆佹渚?

jquery的位置選擇器一

3銆佹渚?

jquery的位置選擇器一

4銆佹渚?

jquery的位置選擇器一

5銆佹渚?

jquery的位置選擇器一