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.
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.
<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">
<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">
不好意思,我是菜鸟。
<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>