The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Returns the adjacent text string.
Syntax
object.getAdjacentText(where)Parameters
- where [in]
-
Type: String
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: String
Returns the first adjacent text string.Standards information
There are no standards that apply here.
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()">
See also
- a
- abbr
- 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
Send comments about this topic to Microsoft
Build date: 11/27/2012