parentTextEditparentTextEdit*
*Contents  *Index  *Topic Contents
*Previous Topic: parentStyleSheet
*Next Topic: parentWindow

parentTextEdit

Description

Returns the next element in the hierarchy that can be used to create a text range that contains the original element.

Syntax

object.parentTextEdit

Settings

This read-only property is an element object if the parent exists. Otherwise, it is null.

Example

The following example retrieves the parent element (if needed), creates the text range, moves to the original element, and selects the first word in the element.

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

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML, I, IFRAME, IMG, INPUT, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, META, NEXTID, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.