java學習

          java學習

           

          jquery移除事件

          <html>
          <head>
          <style type="text/css">
          *{margin:0;padding:0;}    
          body { font-size: 13px; line-height: 130%; padding: 60px; }
          p {width:200px;background:#888;color:white;height:16px;}
          </style>
          <script src="../../scripts/jquery-1.3.1.js" type="text/javascript"></script>
          <script type="text/javascript">
              $(function(){
                 $('#btn').bind("click", function(){
                               $('#test').append("<p>我的綁定函數1</p>");
                        }).bind("click", function(){
                               $('#test').append("<p>我的綁定函數2</p>");
                        }).bind("click", function(){
                                 $('#test').append("<p>我的綁定函數3</p>");
                        });
                 $('#delAll').click(function(){
                        $('#btn').unbind("click");
                 });
           $('#delTwo').click(function(){
                        $('#btn').unbind("click",myFun2);
                 });
              })
          </script>
          </head>
          <body>
          <button id="btn">點擊我</button>
          <div id="test"></div>
          <button id="delAll">刪除所有事件</button>
          <button id="delTwo">刪除第二個事件</button>
          </body>
          </html>

          <html>
          <head>
          <style type="text/css">
          *{margin:0;padding:0;}    
          body { font-size: 13px; line-height: 130%; padding: 60px; }
          p {width:200px;background:#888;color:white;height:16px;}
          </style>
          <script src="../../scripts/jquery-1.3.1.js" type="text/javascript"></script>
          <script type="text/javascript">
              $(function(){
                 $('#btn').one("click", function(){
                               $('#test').append("<p>我的綁定函數1</p>");
                        }).one("click", function(){
                               $('#test').append("<p>我的綁定函數2</p>");
                        }).one("click", function(){
                                 $('#test').append("<p>我的綁定函數3</p>");
                        });
              })
          </script>
          </head>
          <body>
          <button id="btn">點擊我</button>
          <div id="test"></div>
          </body>
          </html>

          posted on 2013-03-19 10:19 楊軍威 閱讀(533) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 赣州市| 临清市| 南投市| 凤城市| 新乡市| 桑植县| 平罗县| 巴林左旗| 大兴区| 塔河县| 许昌县| 广州市| 安龙县| 库伦旗| 利辛县| 万盛区| 巴东县| 都兰县| 特克斯县| 民丰县| 仪陇县| 庆云县| 黔西| 旬邑县| 巫溪县| 吉安县| 同德县| 揭阳市| 呼玛县| 都安| 三明市| 禄劝| 海伦市| 合川市| 湾仔区| 平陆县| 商城县| 巫溪县| 南江县| 万源市| 雅江县|