What is the equivalent to the Element Object in Internet Explorer 9?
if (!Element.prototype.addEventListener) { Element.prototype.addEventListener = func
Here's something for those who like beautiful code.
function addEventListener(obj,evt,func){ if ('addEventListener' in window){ obj.addEventListener(evt,func, false); } else if ('attachEvent' in window){//IE obj.attachEvent('on'+evt,func); } }
Shamelessly stolen from Iframe-Resizer.