abdelelbouhy Posted February 15, 2010 Share Posted February 15, 2010 function addEvent(node, type, listener){ if(!isCompatible()){ return false;} if(!(node = $(node))){ return false;} if(node.addEventListener){ //w3c method node.addEventListener(type, listener, false); return true; }else if(node.attachEvent){ //MSIE method node['e'+type+listener] = listener; node[type+listener] = function(){ node['e'+type+listener](window.event); } node.attachEvent('on'+type, node[type+listener]); return true; } return false; };hello guys anyone please can explain this line for menode['e'+type+listener] = listener; node[type+listener] = function(){ node['e'+type+listener](window.event); }why there is the letter 'e' in node['e'+type+listener] and what realy he want to say in this line is it = (node.e.type.listener) Link to comment Share on other sites More sharing options...
Ingolme Posted February 15, 2010 Share Posted February 15, 2010 It actually doesn't make sense to me. Where did you get this function? Besides, there's no "isCompatible()" function either.This is what the function should look like: function addEvent(node, type, listener){ if(node.addEventListener){ //w3c method node.addEventListener(type, listener, false); return true; }else if(node.attachEvent){ //MSIE method node.attachEvent('on'+type, node[type+listener]); return true; } else { node['on'+type] = listener; }return false;}; Link to comment Share on other sites More sharing options...
abdelelbouhy Posted February 15, 2010 Author Share Posted February 15, 2010 isCompatible is a function i used it in my libarary and here is the link for the ADS libarary which i'm followinghttp://www.google.com/codesearch/p?hl=en#7...;cd=3&ct=rcthanx Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.