On 2005-12-29, ukrbend <uk******@yahoo.com> wrote:
I'm trying to create a link to a certain part of a page on another
website that has
no anchor (i.e. ID or name) at the position on the page I want to link
to. So I can't do something like theotherpage.html#anchorname.
However, since there is a unique keyword at the position I want to link
to I thought perhaps I could load the page, then search for this
keyword and then reposition to that point. Can javascript do something
like this?
probably. but in most cases it'd be much easier to put the <a>nchor into the
document.
you won't be able to scroll the document if it's from a different server
unless you can get your javascript included on the other server....
anyway to do what you're asking.
Traverse the DOM tree looking for the text you want and then figure out the
coordinates of the item you're chasing. and scroll to that.
sounds simple? AIUI calculating the screen location of an element can be
tricky.
It may be easier to make an anchor and insert it before the text. and then
update location.hash to refer to it.
Bye.
Jasen