演示-联合选择器和反选择器

HTML代码:

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>index</title>
 6 <script type="text/javascript" src="jquery-3.1.1.min.js"></script>
 7 <script type="text/javascript">    
 8     $(function(){
 9                $(".ull,a").css("color","red");
10                $("div :not(a)").css("color","blue");
11         }
12     );
13 </script>
14 </head>
15 <body>
16 <div style="border:1px solid;">
17     <a id="last" value="123" href="#">兴趣:</a>
18     <p>电影</p>
19 </div>
20 <ul class="ull">
21     <li>I</li>
22     <li>II</li>
23     <li>III</li>
24 </ul>
25 </body>
26 </html>

结果:

 

posted @ 2016-10-05 21:46  舒山  阅读(300)  评论(0编辑  收藏  举报