Click to return to the DHTML, HTML     
forward Method     getAttribute Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

getAdjacentText Method


Returns the adjacent text character.

Syntax

object.getAdjacentText(sWhere)

Parameters

sWhereRequired. String that specifies where the text is located, using one of the following values:
beforeBeginText is returned immediately before the element.
afterBeginText is returned after the start of the element but before all other content in the element.
beforeEndText is returned immediately before the end of the element but after all other content in the element.
afterEndText is returned immediately after the end of the element.

Return Value

Returns the first adjacent text character.

Example

This example uses the getAdjacentText method to find specific text.

<SCRIPT>
function fnFind(){
var sWhere = oSel.options[oSel.selectedIndex].text;
alert(oPara.getAdjacentText(sWhere));
}
</SCRIPT>
This is the text before (beforeBegin).
<P ID=oPara>
This is the text after (afterBegin).
<B>A few extra words.</B>
This is the text before (beforeEnd).
</P>
This is the text after (afterEnd).

<SELECT ID=oSel>
<OPTION SELECTED>beforeBegin
<OPTION>afterBegin
<OPTION>beforeEnd
<OPTION>afterEnd
</SELECT>
<INPUT TYPE="button" VALUE="Find text" onclick="fnFind()">

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, Hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, NEXTID, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.