标签:javascrip htm col lan 一个 src red utf-8 text
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function () {
//为紧接在p元素后的下一个元素是b的设置颜色
$("p").next("b").css("color","green");
//为紧接在p元素后的下一个元素是div设置颜色,如果不是则不设置颜色
$("p").next("div").css("color","red");
//为div后的所有span元素设置颜色
$("div").nextAll("span").css("color","blue");
})
</script>
</head>
<body>
<p>QQQQQQQQQQQQ</p>
<B>UUUUUUUU</B>
<div>YYYYYYYYY</div>
<span>MMMMMMMM</span>
<b>IIIIIIII</b>
<span>OOOOOOOO</span>
</body>
</html>
标签:javascrip htm col lan 一个 src red utf-8 text
原文地址:https://www.cnblogs.com/kukai/p/10915375.html