문제

I am trying to create a simple fallback function, which will make sure addeventlistener will work in IE versions older than 9.

So far i have this

if (!Element.prototype.addEventListener)
{ 
     Element.prototype.addEventListener =
           function(ev, fc)
            {
                xxx.attachEvent('on' + ev, fc);
            }
}

The problem is, that I don't know how to get the reference to the element to which the event is being attached to. (the xxx)

Any advice is appreciated.

도움이 되었습니까?

해결책

That's​​​​​​​​​​​​​​​​​ this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top