473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Reposition on a linked page with no anchor?

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?

Thanks

Dec 29 '05 #1
5 2280
http://msdn.microsoft.com/library/de...llintoview.asp

object.scrollIntoView(). Might be an IE only thing. I don't know how
you could run a script on another page though.

Dec 29 '05 #2
http://msdn.microsoft.com/library/de...llintoview.asp

object.scrollIntoView(). Might be an IE only thing. I don't know how
you could run a script on another page though.

Dec 29 '05 #3
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
Dec 30 '05 #4
Ivo
"ukrbend" 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?


Yes, this is a common task for Javascript, but like anything Javascript, it
will only work within one website. Cross-domain restrictions (google for
that) prohibit script from your site to access scroll positions or anything
on the other site. All I think of for this situation is you write to the
other webmaster and ask for that anchor to be put there.

hth
ivo
http://www.lear.shakespearians.com/
Dec 30 '05 #5
ukrbend 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?


No. scrollIntoView(), which is also proprietary to the IE DOM,
will not work when the target document is not already displayed.
PointedEars
Dec 30 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dominic | last post by:
I have a home page on an intranet called default.asp I just type in the server name to take me to the default page http://server. The home page has an anchor name tag: <A name="fred">Freds Info</A>...
3
by: bigbinc | last post by:
set scroll position in javascript. Is there a way to do this without using document.location, example. document.location = "#gohere" <a name="gohere">
1
by: Michael Satterwhite | last post by:
Is there a way to force a window to scroll to the bottom in response to an event? Dependiing on conditions, I want to move the currently viewed portion of the browser window to a section at the...
7
by: Daniel | last post by:
I want to write a method to remove the last node of the linked list. But the error "Access Violation" exists and the error point to this method. What does it means by Access Violation and how can...
3
by: DonnyW | last post by:
I am working on an application that displays a list of items (biglist.aspx). With each item, there is a link that takes the user to another aspx page for updating the specific details of that item...
2
by: Ken Slight | last post by:
Hello. Does anyone know how to navigate to a specific anchor within an ASPX page? For example, I have <a name='Test'>Hey there</a>, and I want to direct someone to that anchor in the PageLoad...
1
by: umamy | last post by:
Hi, I am writing code to do the followin: - user clicks a link - the page reloads and sets a cookie with a js function in the header. The function reloads the same page with the cookie set and...
1
by: David C | last post by:
I have posted this question, which I think is very simple on several sites, and nobody seems to know what I am talking about. At my wits end here. Please help. I am putting together a site...
3
by: Queez | last post by:
Very quick question. I have a master page (M1) and three content pages (C1, C2, C3). In M1, there's a list of three anchors (A1, A2, A3) which point towards the three content pages. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.