案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
$(document).ready(function(){
6
  $("button").click(function(){
7
    $("p:first").removeClass("intro").addClass('main');
8
  });
9
});
10
</script>
11
<style type="text/css">
12
.intro
13
{
14
font-size:120%;
15
color:red;
16
}
17
.main
18
{
19
font-size:90%;
20
color:blue;
21
}
22
</style>
23
</head>
24
25
<body>
26
<h1>This is a heading</h1>
27
<p class="intro">This is a paragraph.</p>
28
<p>This is another paragraph.</p>
29
<button>改变第一个段落的类</button>
30
</body>
31
</html>
32