潜力博客

人生的最大遗憾莫过于错误地坚持了不该坚持的,轻易地放弃了不该放弃的...

« SortedList 类(using System.Collections)Excel导入MSSQL2000时出现"对于所指定的缓冲区来讲太大"错误的解决方法 »

让eWebEditor编辑器支持IE6.IE7.IE8傲游浏览器的方法

 

最近项目用了eWebEditoreWebEditor在线HTML文本编辑器,发现点击eWebEditor上的所有按钮都没反应,eWebEditor一直都没改过,很少纳闷,经过排除最终确定问题出在IE浏览器的版本。
解决eWebEditor不支持IE8.IE7.傲游浏览器的方法如下:

1、首先找到eWebEditor编辑器所在的目录,然后搜索到editor.js文件,由于eWebEditor有很多个版本,所以editor.js文件所在的目录也有所不同,有的可能在Include目录下,有的可能在js目录下。

2、用记事本打开editor.js文件,找到如下代码:

if (element.YUSERONCLICK) {
    eval(element.YUSERONCLICK + "anonymous()");
}

由于eWebEditor编辑器版本不同,有的可能找不到上面的代码,而是下面这样的代码,两种代码只是书写格式不同而已,含义是一样的:

if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
    
3、将上面的代码替换为下面的代码即可:

if(navigator.appVersion.match(/8./i)=='8.' || navigator.appVersion.match(/7./i)=='7.' || navigator.appVersion.match(/MAXTHON/i)=='MAXTHON')
 {
        if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "onclick(event)");   
 }
 else
 {
       if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
 }
注:面前最新版本的傲游浏览器,没有用到IE8内核,而是IE7内核.

如果上面还不行的话,请使用下面的方法:
try{
        if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()"); 

catch(e){
        if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "onclick(event)"); 
}

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Search

Categories

Previous

Comments

Archives

Copyright © 2008 潜力博客 All Rights Reserved.粤ICP备08117954号
Powered By Z-Blog Designed by Han'space