Property  DescriptionboundingHeight  Retrieves the height of the rectangle that bounds the TextRange object.  
boundingLeft  Retrieves the distance between the left edge of the rectangle that bounds the TextRange object and the left side of the object that contains the TextRange. 
boundingTop  Retrieves the distance between the top edge of the rectangle that bounds the TextRange object and the top side of the object that contains the TextRange.  
boundingWidth  Retrieves the width of the rectangle that bounds the TextRange object.  
htmlText  Retrieves the HTML source as a valid HTML fragment.  
offsetLeft Retrieves the calculated left position of the object relative to the layout or coordinate parent, as specified by the offsetParent property.  
offsetTop  Retrieves the calculated top position of the object relative to the layout or coordinate parent, as specified by the offsetParent property.  
text  Sets or retrieves the text contained within the range.

解决方案 »

  1.   

    rng.innerHTML="<br>插入的内容";
      

  2.   

    insertAdjacentHTML 方法:<div id=mxh>原来的</div>
    <input onclick="document.all.mxh.insertAdjacentHTML('beforeBegin','<div>新加的</div>')" type=button value="Insert Before">
    <input onclick="document.all.mxh.insertAdjacentHTML('beforeEnd','<div>新加的</div>')" type=button value="Insert Before End">
      

  3.   

    孟子,你的方法中的第二个会把新元素插入到旧元素的里面去:
    <div id=mxh>原来的</div>
    <input onclick="document.all.mxh.insertAdjacentHTML('beforeBegin','<div>新加的</div>')" type=button value="Insert Before">
    <input onclick="document.all.mxh.insertAdjacentHTML('beforeEnd','<div>新加的</div>')" type=button value="Insert Before End">
    <input onclick="alert(document.all.mxh.outerHTML)" type=button value="看看HTML">
      

  4.   

    是啊。beforeEnd嘛^_^,可以应afterEnd的
      

  5.   

    各位老大:document.all.mxh是什么意思?我在jsdoc上查不到。
    不好意思,我是菜鸟。
      

  6.   

    对不起,没看清楚 net_lover(孟子E章) 的回复,见笑了。
      

  7.   

    各位,document.all.mxh.insertAdjacentHTML('beforeEnd','<div>新加的</div>')" 这样象不能在选择的地方插入html文本,而是插在整个mxh的前面了。我要的效果是这样的:
    <input type=button value="插入文字" onclick="instText()">
    <div id=txt>123asdfafasf</div>
    <script>
    function instText()
    {  var rng = document.selection.createRange();
       rng.text="<b>这是新插入的内容</b>";
      // document.all.txt.insertAdjacentHTML("afterBegin","<b>新加的</b>");
    }
    </script>