Home | Top | Free Ajax Editor | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Searches for text in the document and positions the start and end points of the range to encompass the search string.
Syntax
bFound = TextRange .findText( sText [ , iSearchScope ] [ , iFlags ] )Parameters
sText | Required. String that specifies the text to find. | ||||||||||||||||
iSearchScope | Optional. Integer that specifies the number of characters to search from the starting point of the range. A positive integer indicates a forward search; a negative integer indicates a backward search. | ||||||||||||||||
iFlags | Optional. Integer that specifies one or more of the following flags to indicate the type of search:
|
Return Value
Boolean that returns one of the following values:
true | The search text was found. |
false | The search text was not found. |
Remarks
A range has two distinct states: degenerate and nondegenerate.
A degenerate range is like a text editor caret (insertion point) —it does not actually select any characters. Instead, it specifies a point between two characters. The end points of a degenerate range are adjacent.
A nondegenerate range is like a text editor selection, in that it selects a certain amount of text. The end points of a nondegenerate range are not adjacent.
The value passed for the iSearchScope parameter controls the part of the document, relative to the range, that is searched. The behavior of the findText method depends on whether the state is degenerate or nondegenerate:
This feature might not be available on non-Microsoft® Win32® platforms.
A text range is not modified if the text specified for the findText method is not found.
Example
This example creates a TextRange over the body of the document, and then uses the findText method to search for text with various flag combinations. The results are indicated in the example code comments.
<HTML>
Standards Information
There is no public standard that applies to this method.
Applies To
|
TextRange |
Home | Top | Free Ajax Editor | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |