All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
教你安装SQL Server 2005示例数据库_[SQL Server教程]
Atlas快速入门之实战Atlas_.net资料_编程技术
应用技巧:动态网页中直接不让访问PHP程序文件_php资料_编程技术
Asp.Net,Ajax,学习笔记9,JavaScript的原生类型以及相关扩展(上)_[Asp.Net教程]
SQL,Server,2005,CLR,功能简介_[SQL,Server教程]
深入ASP.NET,2.0的提供者模型_[Asp.Net教程]
2种删除SQL SERVER数据库日志方法_[SQL Server教程]
利用PHP和AJAX创建RSS聚合器_php资料_编程技术
ASP.NET技巧:根据xsd生成xml文档_.net资料_编程技术
C#中程序调试之终止执行
Reading number is top 10 pictures
你是左脑型还是右脑型
Other people's teacher VS my teacher
The real super beauty13
9.3阅兵全景图7-指挥系统和后勤保障系统梯队
何炅哥为中国人的平均工资鸣不平了
Photographed the passion of the clients and prostitutes in the sex trade picture2
From China fortress sora aoi2
身材野火台灣美女1
Plump, too plump!2
Chinese paper-cut grilles art appreciation7
Download software ranking
Kung fu panda - the secret of the teacher
网络管理员第三版
1400篇各类破解文章
The Bermuda triangle2
SQL2000 For 4IN1
Boxer's Top ten classic battle10
变速齿轮3.26
Ashlynn Video4
Tram sex maniac 2 (H) rar bag6
电脑知识及技巧大合集
归海一刀 published in(发表于) 2014/3/16 2:53:11 Edit(编辑)
jQuery事件总结_[AJAX教程]

jQuery事件总结_[AJAX教程]

jQuery事件总结_[AJAX教程]

很少写这些,看了1.2.3版本的改进,确实佩服,很方便.


1.绑定事件
(1)
("p").bind("click", function(e){});
(2)
("p").click(function() {})
2.删除事件


(1)删除特定事件
("div").unbind("click");
(2)删除所有事件
("div").unbind();
3.触发事件


(1)trigger方法 触发特定元素事件
("div").trigger('click');(2)triggerHandler方法 与trigger方法相似,但不触发浏览器默认事件,如focus事件,使用此方法,将会阻止焦点到元素上
("input").triggerHandler("focus");


4.特殊事件
(1)one(string event,function data)
此事件只执行一次则被删除
("p").one("click", function(){
alert("test");
});


(2)hover(over, out)
切换mouseover与mouseout事件


("td").hover(
function () {
(this).addClass("hover");
},
function () {
(this).removeClass("hover");
}
);
可用unbind mouseover与mouseout方法来删除此事件
(3)toggle(oldclick,newclick)
切换执行click事件


("li").toggle(
function () {
(this).css("list-style-type", "disc")
.css("color", "blue");
},
function () {
(this).css({"list-style-type":"", "color":""});
}
);
可用unbind click方法来删除此事件


5. 1.2.3版本新增功能
(1)事件命名空间(便于管理)


实际使用方面:
1.当不需要全部事件,删除特定2个以上的事件.


示例:
("div").bind("click.plugin",function() {} );
("div").bind("mouseover.plugin", function(){});
("div").bind("dblclick", function(){});
("button").click(function() {("div").unbind(".plugin"); })
在事件名称后面加命名空间,在删除事件时,只需要指定命名空间即可.以上代码执行以后,dbclick仍然存在.


(2)相同事件名称,不同命名的事件执行方法


示例:
("div").bind("click", function(){ alert("hello"); });
("div").bind("click.plugin", function(){ alert("goodbye"); });
("div").trigger("click!"); // alert("hello") only
以上trigger方法则根据事件名称来执行事件.


简单的写几句.以上的几个方法还是非常实用方便的


来源:http://www.cnblogs.com/Clingingboy







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.