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)  編輯  收藏


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


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 余姚市| 东丽区| 威信县| 夏邑县| 阿坝| 宁城县| 新竹市| 江达县| 吴江市| 武隆县| 彩票| 淳安县| 遂溪县| 赞皇县| 英山县| 重庆市| 石首市| 东兰县| 中山市| 利川市| 荣成市| 天柱县| 万年县| 五大连池市| 钟祥市| 昌黎县| 云阳县| 云南省| 石城县| 丘北县| 逊克县| 屏山县| 莱州市| 甘谷县| 濮阳市| 田东县| 丰宁| 贵溪市| 大邑县| 习水县| 高陵县|