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" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
5 <title>事件命名空间</title>
6 </head>
7 <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
8 <script>
9 $(function(){
10
11 //第一个开发人员
12 /*$('p').click(function(event) {
13 $(this).css('background','red');
14 });*/
15
16 //第二个开发人员
17 /*$('p').click(function(event) {
18 $(this).css('color','blue');
19 });*/
20
21
22 //第三个开发人员
23 //$('p').unbind('click');
24
25 $('p').bind('click.background',function(){
26 $(this).css('background','red');
27 });
28 $('p').bind('click.color',function(){
29 $(this).css('color','blue');
30 });
31
32 $('p').unbind('click.background');
33
34 });
35 </script>
36 <body>
37 <p>我是p标签</p>
38 </body>
39 </html>