2011-03-01 72 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); 

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