JS addEventListener 区别

xiaoxiao2021-02-28  76

ele.addEventListener(type,function(){ fn.call(ele); },true);

ele.addEventListener(type,function(){ fn.call(ele); },false); 区别是,true是捕获事件,捕获事件先运行.

事件源是谁写在前面谁先执行

上面用的少

ele.attachEvent("on"+type,function(){ fn.call(ele); });

IE9+先绑定先执行

IE8-后绑定先执行;

转载请注明原文地址: https://www.6miu.com/read-55545.html

最新回复(0)