最近在学习用javascript的dom操作html内容,但是不知道怎么在光标位置插入一个新的节点,高手请指点,3Q~~~~function cmd_InsertNode() { //光标位置插入节点
editor.focus();
var pos=editorWindow.getSelection().getRangeAt(0);
var nodeOffset=pos.startOffset; //计算当前选中节点的位置
var nodeContent=editorWindow.document.createTextNode("这段文字带有p标签"); //创建文本节点
var nodeTag=document.createElement("p"); //创建<p></p>标签节点
nodeTag.appendChild(nodeContent);
        //然后如何将节点插入到光标当前的位置呢?
}