2011-03-01 68 views
1

問題是在使用Internet Explorer(7或8)運行時,WordPress上的TinyMce庫存在問題。IE中的tinyMce setcontent問題

當我添加內容(如「<h1> hey </h1>」)時,它將Firefox/Chrome中的內容添加到正確的位置,但在IE中,它添加到頁面的開始處(首要內容)。

下面是代碼我使用

變種TXT = "<h1> hey </h1>";

 
var ed = tinyMCE.getInstanceById(domElementId); // domElementId is the div ID for the textarea where i am adding the content. 
ed.selection.setContent(txt); 

任何人都可以建議可能是什麼原因/修復?謝謝。

+1

沒關係。我發現我不需要選擇實例。 ed.setContent()的作品。 – sbr 2011-03-01 21:43:28

回答

1

使用ed.setContent()而不是使用ed.selection.setContent()。 它會在IE中工作正常

2

對Internet Explorer 8中使用TinyMCE的同樣的問題,這裏是我已經找到了解決辦法:

var ed = tinyMCE.getInstanceById(domElementId); 
*ed.focus();* 
ed.selection.setContent(txt); 

缺少的部分是一個地方集中。