Required.
String that specifies where the text is located 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
Returns the first adjacent text string.
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()">
Standards Information
There is no public standard that applies to this method.