Forum Moderators: open

Message Too Old, No Replies

Link to anchor in frameset

         

Rene_Sterk

2:47 am on Aug 18, 2004 (gmt 0)

10+ Year Member



Hi,
I've read many posts on directing to anchors in framesets on the SAME page, directing to anchors in a NEW window, but how can I link to an anchor in a frameset that is to be loaded in the same window?

So:
1. Click link on entry page (normal html page).
2. Page 2 loads in same window. Frameset with anchors in one of the frames.
3. the frame with the anchors jumps to the appropriate anchor.

The problem that I have is that I cant find just a SINGLE line of code that does the above!
I've tried "splitting it up", i.e. first load the next page and then jump to the anchor using:

newWindow.mainFrame.location.href = 'UrlOfTheMainFrame#NamedAnchor'
(with "newWindow" being defined as "the next page")

but this last line is not even read because IE is not "on the page" anymore where this code was in...

Thank you for your help.

tedster

2:48 pm on Aug 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Rene, and welcome to the forum.

This is a challenging set-up and I doubt that there is a straight HTML solution - which you probably realize since you are using javascript.

I assume that there are many possible named anchor on the framed page, right? So you can't just hardcode the anchor into the frameset's src attribute.

You will probably need to pass the exact anchor name to the next page as variable attached as a query string (a bit messy, but it works) You just need a script in your frameset page that will pull that query string from the end of the URL and add it as the anchor tag. Then you use document.write() to write the actual frameset page altogether.

It will be something like this script for placing one of many pages into a frameset:

[webmasterworld.com...]

...but you will only need to pass the named anchor. However, if you wanted, you could use the entire script as-is, and pass the complete URL wincluding it's anchor.

Rene_Sterk

10:11 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



Thx TEdster!

I had a feeling I was not asking for something straightforward!
usually by searching all kinds of forums I will eventually find an answer, but since I couldnt find this one, I expected the worse!

Anywho, I just started programming, so it will take a while to figure out how to do what you're saying.

thanks for the tip....and of course the welcome!

cheers

rene