简体   繁体   English

IE8中的“预期对象”错误[JavaScript]

[英]'Object Expected' error in IE8 [JavaScript]

I keep getting an 'Object expected' error in IE8, works fine in Chrome & Firefox. 我在IE8中不断收到“对象预期”错误,在Chrome和Firefox中工作正常。 The error points to this bit of script: 错误指向脚本的这一点:

<script type="text/javascript">
        var oEdit1 = new InnovaEditor("oEdit1");
        oEdit1.REPLACE("Description");
</script>

I also get the same exception when debugging in Visual Studio. 在Visual Studio中进行调试时,我也会遇到相同的异常。 I'm not sure if its related but this is what it points to: 我不确定它是否相关,但这就是它的含义:

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"]
];

The code above was found in the InnovaStudio WYSIWIG Editor source files. 上面的代码在InnovaStudio所见即所得编辑器源文件中找到。 I read elsewhere that type="text/javascript" should be replaced with language="javascript" and tried it out but doesn't work. 我在其他地方读过,应该将type="text/javascript"替换为language="javascript"并尝试使用,但不起作用。 Any ideas? 有任何想法吗?

EDIT Here's the initializing script for InnovaEditor: 编辑这是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);          

    }    

  };

Problem solved! 问题解决了! Turns out I had to place everything in the Scripts folder to get it working. 原来,我必须将所有内容都放在Scripts文件夹中才能正常工作。 Thanks for the help anyway. 无论如何,谢谢您的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM