/ Published in: JavaScript
URL: http://www.digital-web.com/articles/seven_javascript_techniques/
Expand |
Embed | Plain Text
var addListener = function() { if ( window.addEventListener ) { return function(el, type, fn) { el.addEventListener(type, fn, false); }; } else if ( window.attachEvent ) { return function(el, type, fn) { var f = function() { fn.call(el, window.event); }; el.attachEvent('on'+type, f); }; } else { return function(el, type, fn) { element['on'+type] = fn; } } }();
You need to login to post a comment.
