我在MS word的VBA帮助中看到过这方面的内容,但没研究,你也可以去那里找,但装MS word时要选择VBA 帮助才行

解决方案 »

  1.   

    MSDN这么写的:
    Creates a TextRange object for the element.SyntaxoTextRange = object.createTextRange()
    Return ValueReturns a TextRange object if successful, or null otherwise. ResUse a text range to examine and modify the text within an object.ExamplesThis example uses the createTextRange method to create a text range for the document, and then uses the text range to display all the text and HTML tags in the document.<SCRIPT LANGUAGE="JScript">
    var rng = document.body.createTextRange( );
    if (rng!=null) {
        alert(rng.htmlText);
    }
    </SCRIPT>
    This example uses the createTextRange method to create a text range for the first button element in the document, and then uses the text range to change the text in the button.<SCRIPT LANGUAGE="JScript">
    var coll = document.all.tags("BUTTON");
    if (coll!=null && coll.length>0) {
        var rng = coll[0].createTextRange();
        rng.text = "Clicked";
    }
    </SCRIPT>