【发布时间】:2013-05-01 07:25:43
【问题描述】:
我在 IE8 中不断收到“预期对象”错误,在 Chrome 和 Firefox 中运行良好。错误指向这段脚本:
<script type="text/javascript">
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.REPLACE("Description");
</script>
在 Visual Studio 中调试时,我也遇到了同样的异常。我不确定它是否相关,但这就是它所指向的:
this.arrParagraph = [
[getTxt("Heading 1"), "H1"],
[getTxt("Heading 2"), "H2"],
[getTxt("Heading 3"), "H3"],
[getTxt("Heading 4"), "H4"],
[getTxt("Heading 5"), "H5"],
[getTxt("Heading 6"), "H6"],
[getTxt("Preformatted"), "PRE"],
[getTxt("Normal (P)"), "P"],
[getTxt("Normal (DIV)"), "DIV"]
];
以上代码可在 InnovaStudio WYSIWIG 编辑器源文件中找到。我在其他地方读到 type="text/javascript" 应该替换为 language="javascript" 并尝试过但不起作用。有什么想法吗?
编辑这是 InnovaEditor 的初始化脚本:
edtCnt = document.createElement("DIV");
edtCnt.id = "innovaeditor" + i;
txt.parentNode.insertBefore(edtCnt, txt);
window["oEdit"+i] = new InnovaEditor("oEdit"+i);
var objStyle;
if( window.getComputedStyle ) {
objStyle = window.getComputedStyle(txt,null);
} else if( txt.currentStyle ) {
objStyle = txt.currentStyle;
} else {
objStyle = {width:window["oEdit"+i].width, height:window["oEdit"+i].height};
}
window["oEdit"+i].width=objStyle.width;
window["oEdit"+i].height=objStyle.height;
if(opt) {
for(var it in opt) {
window["oEdit"+i][it] = opt[it];
}
}
window["oEdit"+i].REPLACE(txt.id, "innovaeditor" + i);
}
};
【问题讨论】:
-
您可能需要更新项目中的 JQuery 版本和/或删除仍在 Scripts 文件夹中的旧版本。虽然我不熟悉 Innova 编辑器,但我在其他基于 JQuery 的控件中看到了类似的问题。
-
猜猜这可能会有所帮助。我使用的是 MVC 中提供的默认版本,即 1.7.1 - 我知道,对吧?虽然 Innova 运行在纯 JavaScript 上,但确实让我很难让它与 jQuery 一起运行。
-
我尝试升级到较新版本的 jQuery,但仍然没有骰子。我再次查看了该错误,它一直引用'new InnovaEditor("oEdit1");'线。我现在不知道该怎么做。
-
还有其他建议吗?我真的没有想法了。
-
您是否也删除了 Scripts 文件夹中的旧版本 JQuery?
标签: c# javascript asp.net-mvc-4 internet-explorer-8 object-expected