scrolling to a known text?

O

optimistx

How to scroll an (almost) arbitrary page in a frame to a position, where
a certain text is visible?

Assume that there is a frameset with frame A and frame P. In my server I
make frame P containing a form and gather there customer opinions (eg.
polls) about a page in frame A. Frame A can contain
a page made by others, so there are security restrictions if trying to
access the contents of frame A with the javascript code in my frame P.

If the contents of A is short, it is easy for my customer to look at A
and P side by side and fill the poll form in P.

But if A is long, it is necessary to scroll it to the correct location.
E.g let us imagine that A contains a discussion group. Javascript code
in P one has to scroll A to the writing of a certain person X.

If there happens to be an anchor <a name="Xname"> in the beginning of X,
then javascript code can ask the loading of the page to the anchor
XName, href="http://pageurl#Xname" and everything is fine.

If there is no anchors near but javascript code knows e.g some keywords
or phrases of X, how to scroll there?

A solution is to read the htmlpage A to the server, add an invisible
anchor there and load the modified page to the frame A of the customer
machine. There might be legal problems in modifying the page at the
server, invisibly though. Is there an elegant way to achieve the same
result without modifying the page in A? Customers have many types of
browsers, old and new.

If the alien page in A is first read to server and sent from there to
the customer then the security restriction is no more applicable. Any
search etc can be done there.

In short, which javascript code in frame P can scroll the page in frame
A to the position where there is text 'this is some unique text...'?

If the answer is one line with 15 chars, I do not know whether to feel
ashamed, happy, or both :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top