View Full Version : Target another frameset?

10-04-2002, 08:13 PM
Our site has several different framesets. I cannot figure out how to create a link from the "main" frame of one frameset to open a page in the "main" frame of another frameset.

This works of course if the link is to the frameset (index.html) page of another frameset, but not if the link is to a sub page.

For example, on our home page we have a link advertising a product. That product page needs to open in a different frameset.
I guess the "target" attribute only works for pages within the same frameset. When I try to target the name of a frame in the other frameset, the page actually opens in a new browser window by itself, in other words, it does not recognize the target.

Is there a way to do what I am trying to do? :confused:


10-04-2002, 09:05 PM
You could pass the page in the url to load in the "main" frame of the new frame set. Your frame set code would look like this:
<title>Frame Print Demo</title>
function frame_saver()
if (self.location.search)
parent.frameb.location = location.search.substring(1,location.search.length);
window.onload = frame_saver;
<frameset rows="25%,*" border="1">
<frame src="looka.html" name="framea">
<frame src="lookb.html" name="frameb">

And the link would look something like this:
<A HREF="frset.html?mypage.html">Click Me</A>

When you clicked on the above link it would load frset.html into the window. the script in frset.html would then check to see if anything was attached to the url and if it was it would load that into the specified frame. I also have a default page there incase something goes wrong.

10-04-2002, 10:39 PM
That works great. I had a feeling java would be the answer, but I am still a bit new with java.

Thank you very much.:thumbsup:


10-04-2002, 11:34 PM
Is there way to do this so the link to the new frameset does not open a new browser window?

What happens is that the page opens in a new browser, in the correct frameset, in this case, the products frame. But, if you then click on the product links in the left menu frame, the pages from those links continue to open in new browsers and not inthe frame! (this is the frameset with the javascript).

Now what is weird, is that if you go to this products page the usual way, the menu links work fine. Only in the new browser window (from the link you helped me create) do they act weird.

Clear as mud?

Thanks, Barko