XXXXX
C/C++
XXXXX
C#/.net
XXXXX
js
java
java
开发导航 开发导航 www.endv.cn
天云

向第一个 p 元素添加一个类

This is a heading

This is a paragraph.

This is another paragraph.

111

 

 1 <html>
 2 <head>
 3 <script type="text/javascript" src="/jquery/jquery.js"></script>
 4 <script type="text/javascript">
 5 $(document).ready(function(){
 6   $("button").click(function(){
 7     $("p:first").addClass("intro");
 8   });
 9 });
10 </script>
11 <style type="text/css">
12 .intro
13 {
14 font-size:120%;
15 color:red;
16 }
17 </style>
18 </head>
19 
20 <body>
21 <h1>This is a heading</h1>
22 <p>This is a paragraph.</p>
23 <p>This is another paragraph.</p>
24 <button>向第一个 p 元素添加一个类</button>
25 </body>
26 </html>

 

posted @ 2017-10-09 16:26  Endv  阅读(360)  评论(0编辑  收藏  举报