jQuery live() 实现方法
来源:互联网 发布:福建省广电网络 编辑:程序博客网 时间:2024/04/27 02:45
前几天研究jquery live()的实现方式,网上看了下资料,大体就是给父级绑定事件 然后通过事件冒泡 判断event.target来实现,于是就写了个例子.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title><style type="text/css">.box1 { width:500px; height:500px; border:1px solid #F00; background:#F00; margin:0 auto }.box2 { width:400px; height:205px; border:1px solid #0F0; background:#0F0; margin:30px auto 0 auto; }.box22 { width:400px; height:205px; border:1px solid #0F0; background:#0F0; margin:30px auto 0 auto; }.box3 { width:300px; height:145px; border:1px solid #00F; background:#00F; margin:30px auto 0 auto; }#xx a { display:block; width:100px; height:20px; line-height:20px; }</style><script type="text/javascript">window.onload = function(){document.getElementById("box1").onclick = function(e){var e = e || window.event;var target = e.target || e.srcElement;alert(target.clientWidth);};document.getElementById("xx").onclick = function(e){var e = e || window.event;var target = e.target || e.srcElement;target.style.backgroundColor = "red";target.innerHTML = target.innerHTML+"1"};document.getElementById("xx").innerHTML = "<a href=\"javascript:;\">1</a><a href=\"javascript:;\">2</a><a href=\"javascript:;\">3</a><a href=\"javascript:;\">4</a><a href=\"javascript:;\">5</a>"};</script></head><body><div class="box1" id="box1"><div class="box2"><div class="box3"></div></div><div class="box22"><div class="box3"></div></div></div><p id="xx"> </p></body></html>
- jQuery live() 实现方法
- jQuery live方法
- jquery的live方法
- jQuery 事件 - live() 方法
- jquery live() 替换 方法
- jquery live() 替换 方法
- jquery live方法替代
- jQuery 事件 - live() 方法
- JQuery .live()方法
- jquery中live()方法
- JQuery事件绑定live方法
- jquery live()方法绑定事件
- jQuery 事件 - delegate() live() 方法
- jQuery中.live()方法的使用方法
- jquery live方法 失效的问题
- jquery中的live和on方法
- Jquery方法click() bind() live() delegate()区别
- jquery live()函数原理及实现
- extjs Ext.Ajax.request 从后台得到 String 字符串 在页面显示器内容
- 内存区划分、内存分配、常量存储区、堆、栈、自由存储区、全局区(c++)(二)
- setuid和setgid
- SQL学习(7)分组查询group by
- pgp key
- jQuery live() 实现方法
- http://mirrors.163.com/ubuntu-releases/11.10/
- 解决screen off 后service中的sensor不传数据问题
- linux下网络编程(TCP)
- ssh tunnel
- 数据库的启动停止命令
- Google的面试题
- 看到这个你能明白很多为什么要定义new,为什么函数不要定义
- 64位整数