FF下新增event对象的srcElement、fromElement、toElement三个属性
来源:互联网 发布:电影票比价软件 编辑:程序博客网 时间:2024/06/05 07:28
网摘:
ie下可以直接使用event对象的这三个属性
现在我们需要为FF新增这三个属性:
if(window.addEventListener) { FixPrototypeForGecko(); } function FixPrototypeForGecko() { HTMLElement.prototype.__defineGetter__("runtimeStyle",element_prototype_get_runtimeStyle); window.constructor.prototype.__defineGetter__("event",window_prototype_get_event); Event.prototype.__defineGetter__("srcElement",event_prototype_get_srcElement); Event.prototype.__defineGetter__("fromElement", element_prototype_get_fromElement); Event.prototype.__defineGetter__("toElement", element_prototype_get_toElement); } function element_prototype_get_runtimeStyle() { return this.style; } function window_prototype_get_event() { return SearchEvent(); } function event_prototype_get_srcElement() { return this.target; } function element_prototype_get_fromElement() { var node; if(this.type == "mouseover") node = this.relatedTarget; else if (this.type == "mouseout") node = this.target; if(!node) return; while (node.nodeType != 1) node = node.parentNode; return node; } function element_prototype_get_toElement() { var node; if(this.type == "mouseout") node = this.relatedTarget; else if (this.type == "mouseover") node = this.target; if(!node) return; while (node.nodeType != 1) node = node.parentNode; return node; } function SearchEvent() { if(document.all) return window.event; func = SearchEvent.caller; while(func!=null){ var arg0=func.arguments[0]; if(arg0 instanceof Event) { return arg0; } func=func.caller; } return null; }
转载:http://www.cnblogs.com/tatame/archive/2012/11/20/2779027.html
- FF下新增event对象的srcElement、fromElement、toElement三个属性
- 创建兼容 IE/FireFox 的 event 及 event 的 srcElement、fromElement、toElement 属性
- 创建兼容 IE/FireFox 的 event 及 event 的 srcElement、fromElement、toElement 属性
- event.srcElement ,event.fromElement,event.toElement兼容问题
- HTML DOM Event 对象之(toElement、fromElement、event.srcElement、event.target)
- srcElement,fromElement,toElement
- window.event.srcElement的FF兼容问题
- IE11下event.srcElement获取不到对应属性的解决方法
- 关于JavaScript兼容FF和IE的方法(IE、FF下的srcElement属性)
- 通过event对象的fromElement属性解决热区设置主实体的一个bug
- IE和FF下的srcElement获取
- relatedTarget, fromElement, toElement
- relatedTarget, fromElement, toElement
- event.srcElement属性
- event.srcelement event.target属性
- relatedTarget、fromElement、toElement相关元素
- relatedTarget、fromElement、toElement相关元素
- relatedTarget、fromElement、toElement相关元素
- u-boot第二阶段board.c分析
- APUE读书笔记-第10章 信号
- Remove PCSafeDoctor with WindowsUninstaller.Org Removal Tips
- Mac OS X Terminal 101:终端使用初级教程
- oracle sql优化 三 (转载)
- FF下新增event对象的srcElement、fromElement、toElement三个属性
- _countof宏应用
- JQuery在循环中绑定事件
- jquery_EasyUI的学习
- java向mysql数据库中插入中文乱码问题解决
- oracle sql优化 四(转载)
- 计算路径a对于路径b的相对路径
- js date函数详解
- mac下修改mysql的默认字符集为utf8