案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
function alertMe()
6
{
7
alert("Hello World!");
8
}
9
10
$(document).ready(function(){
11
  $("p").click(alertMe);
12
  $("button").click(function(){
13
    $("p").unbind("click",alertMe);
14
  });
15
});
16
</script>
17
</head>
18
<body>
19
<p>这是一个段落。</p>
20
<p>这是另一个段落。</p>
21
<p>点击任何段落可以触发一个提示框。包括本段落。</p>
22
<button>从 p 元素的 click 事件删除提示框函数</button>
23
</body>
24
</html>
25