'Object Expected' error in IE8 [JavaScript]

732 views Asked by At

I keep getting an 'Object expected' error in IE8, works fine in 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. 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. I read elsewhere that type="text/javascript" should be replaced with language="javascript" and tried it out but doesn't work. Any ideas?

EDIT Here's the initializing script for 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);          

    }    

  };
1

There are 1 answers

0
nouptime On BEST ANSWER

Problem solved! Turns out I had to place everything in the Scripts folder to get it working. Thanks for the help anyway.