0 out of 4 rated this helpful - Rate this topic

parentTextEdit property

Retrieves the container object in the document hierarchy that can be used to create a TextRange containing the original object.

Syntax

JavaScript

p = object.parentTextEdit

Property values

Type: Object

the supported text ranges.

Remarks

The property is an object if the parent exists; otherwise, it is null. For example, the parentTextEdit property of the body is null.

Examples

This example retrieves the parent object, if needed, creates the text range, moves to the original object, and selects the first word in the object.


<SCRIPT LANGUAGE="JScript">
function selectWord()
{
    var oSource = window.event.srcElement ;
    if (!oSource.isTextEdit) 
        oSource = oSource.parentTextEdit;
    if (oSource != null) {
        var oTextRange = oSource.createTextRange();
        oTextRange.moveToElementText(window.event.srcElement);
        oTextRange.collapse();
        oTextRange.expand("word");
        oTextRange.select();
    }
}
</SCRIPT>

 

 

Send comments about this topic to Microsoft

Build date: 2/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ