PDA

View Full Version : Search data in Table


sarvarv
06-25-2002, 10:00 PM
Hi,

I have a window with no menu bar which lists data in a table with 2 columns.

I would like to provide the user with an input box. When the user enters some text I would like to search the table for that text. If text exists, then move the focus, scroll to, to that text.

Can this be done in javascript? Does someone have similar code they may want to share.

Thanks,
V

jkd
06-25-2002, 10:06 PM
http://www.dynamicdrive.com/dynamicindex11/findpage.htm

That works in NS4 and IE4+.

I have my own script that works in NS6+ to an extent (finds the text, gets the offsets, etc), but utilizes Range.prototype.surroundContents inside a Text node, which currently doesn't work (well-known bug).

irka
07-02-2002, 02:25 PM
I am trying to modify this script Find In Page Script All (url in the previous reply) , so the search string value will be passed from a link. something like this

onClick="return findInPage(this.linkname.value);">linkname</a>

Vladdy
07-02-2002, 03:40 PM
Check my page on dynamic table construction. It shows how to access data in individual table cells in cross-browser compatible manner (DOM).

http://www.vladdy.net/WebDesign/DOM_Tables.html

irka
07-02-2002, 06:36 PM
I've sorted out. It should be just
onClick="return findInPage(linkname);">linkname</a>