Blogger Information
Blog 21
fans 0
comment 0
visits 12339
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4月03日js过滤器,11时03分
许增颜
Original
647 people have browsed it

代码如下:

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>0407</title>
	<style type="text/css">
		ul{
			list-style-type: none;
			background-color: black;
		}
		li,h2,h3,h4{
			color: white;00000000000000000000
		}
	</style>
</head>
<body>
	<ul>
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
		<li>5</li>
		<li>6</li>
		<li>7</li>
		<li>8</li>
		<h2>xxx</h2>
		<h3>vvv</h3>
		<h4>yyy</h4>
		<li>9</li>
		<li>10</li>
	</ul>
</body>
</html>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
	// $("li").css("color","red")
	$("li").get(2).style.color = "red"
	$("li").eq(3).css("color","yellow")
	$("li").first().css("color","blue")
	$("li").last().css("color","skyblue")
	$("ul").find("li").css("color","lightgreen")
	$("ul").children("h2,h3,h4").css("color","green")
	$("*").removeAttr("style")
	$("li").eq("3").next().css("color","red")
	$("li").first().nextAll().css("color","black")
	// $('li').eq("3").siblings().css("color","lightgreen")
	$('h2').siblings().css("color","lightgreen")
	$("*").removeAttr("style")
	$("li").add("h2,h3,h4").css("color","lightgreen")
	$("li").slice(2,6).css("color","lightgray")
</script>

运行实例 »

点击 "运行实例" 按钮查看在线实例

效果图:

1.jpg

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post