在eWebEditor的目錄裡找到Editor.js檔案,有的可能在Include目錄下,也有可能在js目錄下,用記事本開啟,在其中找到如下代碼
代碼
| 代碼如下 |
複製代碼 |
|
if (element.YUSERONCLICK) {
eval(element.YUSERONCLICK + "anonymous()");
} |
改為
代碼
| 代碼如下 |
複製代碼 |
|
if (element.YUSERONCLICK)
{
try
{
eval(element.YUSERONCLICK + "onclick(event)");
}
catch (e){
eval(element.YUSERONCLICK + "anonymous()");
}
} |
方法二
因為ie8屏蔽了anonymous方法,所以要將anonymous改成onclick方法。
開啟include下面的editor.js檔案,找到這段代碼:
| 代碼如下 |
複製代碼 |
|
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()"); |
修改為
| 代碼如下 |
複製代碼 |
|
if(navigator.appVersion.match(/8./i)=='8.')
{
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "onclick(event)");
}
else
{
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
} |
把代碼改成這樣之後在ie7和ie8下就都可以正常使用了。
如果還不好使就將上邊的代碼換成如下代碼
| 代碼如下 |
複製代碼 |
|
if (element.YUSERONCLICK) {
try {
eval(element.YUSERONCLICK + "anonymous()");
}
catch(err) {
eval(element.YUSERONCLICK + "onclick(event)");
}
} |