Addeventlistener对旧IE的后备 [英] Addeventlistener fallback for older IE

查看:149
本文介绍了Addeventlistener对旧IE的后备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的回退函数,这将确保addeventlistener可以在早于9的IE版本中工作。

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

到目前为止我有这个

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

问题是,我不知道如何获取对要附加事件的元素的引用。 (xxx)

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)

感谢任何建议。

推荐答案

那是

这篇关于Addeventlistener对旧IE的后备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆