错误:缺少对象 editor.js
- 日期 : 2012-02-05
在做网站的时候,在IE8显示JS错误,缺少对象,editor.js 132行。上网一查,原来是eWebEditor的浏览器兼容问题。以前在IE6下面是没问题的。
editor.js 132行代码是:
if (element.YUSERONCLICK) {
eval(element.YUSERONCLICK + “anonymous()”);
}
替换为
try{
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
}
catch(e){
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "onclick(event)");
}
此种方法在各种IE下都是有效的。