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 杨军威 阅读(517) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜