2

我一直在IE8中收到'Object expected'錯誤,在Chrome瀏覽器中使用Chrome &正常工作。錯誤指向這一點的腳本:IE8中的'Object Expected'錯誤[JavaScript]

<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所見即所得的編輯器源文件中的代碼。我在其他地方看到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);   

    }  

    }; 
+1

您可能需要在項目中更新您的JQuery版本和/或刪除它的舊版本,該版本仍然在您的腳本文件夾中。雖然我不熟悉Innova編輯器,但我發現其他基於JQuery的控件也遇到過類似的問題。 – jfrankcarr 2013-05-07 11:09:50

+0

猜猜可能有幫助。我使用的MVC中提供的默認版本是1.7.1 - 我知道,古代的權利?儘管Innova運行在純JavaScript上,但確實給了我一段艱難的時間,試圖讓它與jQuery並行運行。 – nouptime 2013-05-07 11:19:18

+0

我嘗試升級到更新版本的jQuery,但仍然沒有骰子。我再次看了這個錯誤,它一直提到'新的InnovaEditor(「oEdit1」);'線。我不確定此時該做什麼。 – nouptime 2013-05-08 05:34:20

回答

0

問題解決了!事實證明,我必須將所有內容放在Scripts文件夾中才能正常工作。無論如何,感謝您的幫助。

相關問題