Loading 2 frames with one hyperlink

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
Daniel
Beginner
Beginner
Posts: 1
Joined: Sun Oct 27, 2002 12:56 pm
Contact:

Loading 2 frames with one hyperlink

Post by Daniel »

Hello everybody,

first at all I want to congratulate you for this fantastic and useful menue. But there is still one problem I have to solve! :(

How can I load 2 different frames with one click in your menue? It is very important for me to solve this problem as fast as possible and I hope you can help me.

Thank you very much in advance and best regards from Hamburg, Germany!

Daniel
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hello Daniel,

You could use a small js function that would change the window.location.href in each of the two frames. I would probably set it up so that I could pass the two new URLs as parameters to the function. Let's suppose, for example, that the two frames you want to change are "frame1" and "frame2" (substitute the actual frame names from your own frameset). Your function might look something like this:

Code: Select all

function ChangeFrames(url_frame1, url_frame2)
{
  parent.frame1.location = url_frame1;
  parent.frame2.location = url_frame2;
}
Note the two parameters in the function call: url_frame1 is the new URL to load into frame1; similarly for url_frame2. Also, if you want to be more precise, you could use parent.frame1.location.href =, but that should not be necessary.

To make things easy, you could place the above function definition in your menu_array.js file, above the menu definitions themselves (you could put the function in a separate .js file, but then you'd have to src an additional file on each page). To call the function from a menu item, define the menu item as follows:

Code: Select all

,"Item Name","javascript:ChangeFrames('url_to_page1.html','url_to_page2.html')",,,1
Of course, substitute the appropriate two URLs for the pages you want to load into each frame. You could use relative URLs or fully qualified URLs; whatever your site requires (note however that some versions of JavaScript for some browsers will not update a page unless the URL is fully qualified).

Hope that helps. And best regards to you, from chilly Lincoln, Nebraska, USA!

Kevin
Post Reply