abdelelbouhy Posted February 15, 2010 Report 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 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now