getAdjacentText method

This topic has not yet been rated - Rate this topic

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;
	console.log(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
address
area
b
base
bdo
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
custom
dd
del
div
dl
dt
em
embed
fieldSet
form
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
map
object
ol
option
p
pre
q
s
samp
script
select
small
span
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
u
ul
var

 

 

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.