详细的你可以见:
http://www.php168.com/html/978/bencandy_95198.htm

解决方案 »

  1.   

    W3C standard description
    http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.htmlMicrosoft documentationCreates a TextRange object from the current text selection, or a controlRange collection from a control selection. 
    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/createrange.aspFor the properties and methods of the control range object, visit http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/controlrange/controlrange.asp
    For the properties and methods of the text range object, visit http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_textrange.asp
      

  2.   

    selection 对象--------------------------------------------------------------------------------代表了当前激活选中区,即高亮文本块,和/或文档中用户可执行某些操作的其它元素。
    selection 对象的典型用途是作为用户的输入,以便识别正在对文档的哪一部分正在处理,或者作为某一操作的结果输出给用户。用户和脚本都可以创建选中区。用户创建选中区的办法是拖曳文档的一部分。脚本创建选中区的办法是在文本区域或类似对象上调用 select 方法。要获取当前选中区,请对 document 对象应用 selection 关键字。要对选中区执行操作,请先用 createRange 方法从选中区创建一个文本区域对象。一个文档同一时间只能有一个选中区。选中区的类型决定了其中为空或者包含文本和/或元素块。尽管空的选中区不包含任何内容,你仍然可以用它作为文档中的位置标志。createRange Method  Internet Development Index --------------------------------------------------------------------------------Creates a TextRange object from the current text selection, or a controlRange collection from a control selection. Syntax
    range = selection.createRange()Return Value
    Returns the created TextRange object.
    TextRange 对象--------------------------------------------------------------------------------代表 HTML 元素中的文本。使用此对象可以获取并修改元素中的文本,定位文本中的指定字符串,以及执行影响文本外观的命令。要获取一个文本范围对象,请对 body, button 或 textArea 元素或带有 TYPE 文本的 input 元素应用 createTextRange 方法。如果想要修改文本范围的延展范围,可以使用 move, moveToElementText 和 findText 移动其起始和终止位置。在文本范围内,你可以获取并修改纯文本或 HTML 文本。这些格式的文本完全相同,只是 HTML 文本包含 HTML 标签,而纯文本不包含。
    下面的例子通过 TextRange 对象将 button 元素的文本更改为“已单击”。<SCRIPT LANGUAGE="JScript">
    var b = document.all.tags("BUTTON");
    if (b!=null) {
    var r = b[0].createTextRange();
    if (r != null) {
    r.text = "已单击";
    }
    }
    </SCRIPT>