Chinaunix首页 | 论坛 | 博客
  • 博客访问: 76051
  • 博文数量: 73
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 740
  • 用 户 组: 普通用户
  • 注册时间: 2014-07-04 16:50
文章分类
文章存档

2014年(73)

我的朋友

分类: Html/Css

2014-07-17 10:05:29


点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  2. <html xmlns="">
  3. <head>
  4.  <title>jQuery根据命名空间,删除事件</title>
  5.  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript" src=""></script>
  7.   <script type="text/javascript">
  8.   $(function(){
  9.     $("div").bind("click.plugin",function(){
  10.      $("body").append("

    click事件

    "
    );
  11.     });
  12.     $("div").bind("mouseover.plugin", function(){
  13.      $("body").append("

    mouseover事件

    "
    );
  14.     });
  15.     $("div").bind("dblclick", function(){
  16.          $("body").append("

    dblclick事件

    "
    );
  17.     });
  18.     $("button").click(function() {
  19.         $("div").unbind(".plugin");
  20.     })
  21.   })
  22.   </script>
  23. </head>
  24. <body>
  25. <div style="width:100px;height:50px;background:#888;color:white;">test.</div>
  26. <button >根据命名空间,删除事件</button>
  27. </body>
  28. </html>

阅读(181) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~