View Full Version : Jump to anchor on reload

Cathy McK
01-21-2003, 01:28 AM
I am very new to this and would appreciate any assistance.

I have a window (window A) that has a link on it with the following behaviour attached: onClick: resize window A to approx 1/3 of screen (assume 800*600 res), open new window (window B) to other 2/3 of screen and go to a particular URL in window B. Focus is shifted to window B. This is working fine.

My problem is that I would like the top of window A to show the text immedately following the link that has just been clicked. When the window resizes, the text flips back to the top of the page.

I have tried using an anchor to jump to the point I want in window A, which works...... until the page reloads to its new smaller size - it then jumps back to the top of the page.


01-21-2003, 03:30 PM
You will need to hard-code some anchors (<a name="whatever"></a>) into page A immediately after each possible link which could cause the page to resize. Next, you need to pass the name of the proceeding anchor as an argument to your resize function in your onclick handler. Finally, in the function which resizes page A, you will need to add a line of code at the end to make the page 'jump' to the named anchor. The syntax is:

self.location.hash = whatever;

Does that make sense? I hope so.

Good luck.