<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#bt1").click(function(){
$("div > p").css("background","red")
})
})
$(function(){
$("div > p").css("color",'blue');
})
</script>
</head>
<body>
<input id="bt1" type="button" value="获取div下所有的p标签"/>
<div>
<p>div下的p</p>
<p>div下的p</p>
<p>div下的p</p>
<p>div下的p</p>
<span>div下的span</span>
</div>
<p>单独的p</p>
<p>单独的p</p>
<p>单独的p</p>
<p>单独的p</p>
</body>
</html>
效果图: