案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
function changeSize()
6
{
7
$(this).animate({fontSize:"+=3px"});
8
}
9
function changeColor()
10
{
11
$(this).animate({letterSpacing:"+=2px"});
12
}
13
$(document).ready(function(){
14
  $("p").live("click",changeSize);
15
  $("p").live("click",changeColor);
16
  $("button").click(function(){
17
    $("p").die("click",changeSize);
18
  });
19
});
20
</script>
21
</head>
22
<body>
23
<p>这是一个段落。</p>
24
<p>这是另一个段落。</p>
25
<p>点击任意 p 元素可以增加尺寸和字间距。包括该段落。</p>
26
<button>移除通过 live() 方法为 p 元素添加的 changeSize() 事件处理器</button>
27
</body>
28
</html>
29