SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : HTML and CSS :

Previous DiscussionNext Discussion
 Using HTML or cgi to do a "ctrl-F"

I want to do a CTRL + F on a web page.

moreover I want to make a "search this page" button on a web page.

any help would be great.

Gundy

 

Started By Gundy on Sep 13, 2005 at 8:41:32 AM

7 Response(s) | Reply

View All Replies | Goto Page: 1
hedger on Sep 14, 2005 at 7:47:09 PM

findText Method

Internet Development Index


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:
0 Default. Match partial words.
1 Match backwards.
2 Match whole words only.
4 Match case.
131072 Match bytes.
536870912 Match diacritical marks.
1073741824 Match Kashida character.
2147483648 Match AlefHamza character.

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) ˇXit 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:

  • If the range is degenerate, passing a large positive number causes the text to the right of the range to be searched. Passing a large negative number causes the text to the left of the range to be searched.
  • If the range is nondegenerate, passing a large positive number causes the text to the right of the start of the range to be searched. Passing a large negative number causes the text to the left of the end of the range to be searched. Passing 0 causes only the text selected by the range to be searched.

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.

Show Example

Standards Information

There is no public standard that applies to this method.

Applies To

[ Object Name ]
Platform Version
Win16:
Win32:
Windows CE:
Unix:
Mac:
Version data is listed when the mouse hovers over a link, or the link has focus.
TextRange
Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms.

View All Replies | Goto Page: 1

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2000 InsideDHTML.com, LLC. All rights reserved.