0

节点JAVASCRIPT 代码:

Editor= CKEDITOR.instances['ckeditor1'];


getElem=Editor.document.getSelection().getStartElement();
getElem.setHtml("<Element6>SomeText</Element6>");

工作: 火狐

不工作: Internet Explorer

错误是:`'Editor.document.getSelection()为空或不是对象

如何在 IE 中获取光标位置的父节点?

CKEDITOR 上的数据:

<Element1>SomeText<Element2>SomeText</Element2>

<Element3>Some**[suppose Cursor Is Here]** Text </Element3>

</Element1>

要求的结果:

 <Element1>SomeText<Element2>SomeText</Element2><Element3> 

<Element6>SomeText</Element6>

</Element3></Element1>
4

1 回答 1

0

以下代码运行良好..感谢 * Reinmar*

Editor= CKEDITOR.instances['ckeditor1'];
Editor.focus();
getElem=Editor.document.getSelection().getStartElement();
getElem.setHtml("<Element6>SomeText</Element6>");
于 2012-10-18T05:07:18.923 回答