2 out of 5 rated this helpful - Rate this topic

getAdjacentText method

[This documentation is preliminary and is subject to change.]

Returns the adjacent text string.

Syntax

object.getAdjacentText(where)

Standards information

There are no standards that apply here.

Parameters

where [in]

Type: BSTR

A String that specifies where the text is located by using one of the following values.

beforeBegin

Text is returned immediately before the element.

afterBegin

Text is returned after the start of the element but before all other content in the element.

beforeEnd

Text is returned immediately before the end of the element but after all other content in the element.

afterEnd

Text is returned immediately after the end of the element.

Return value

Type: StringReturns the first adjacent text string.

Examples

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()">

 

 

Build date: 2/14/2012

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