Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:20
Loading 2 frames with one hyperlink
Poster: Daniel
Dated: Sunday October 27 2002 - 12:05:13 GMT
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
Poster: kevin3442
Dated: Monday October 28 2002 - 4:03:13 GMT
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:
function ChangeFrames(url_frame1, url_frame2)
{
parent.frame1.location = url_frame1;
parent.frame2.location = 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:
,"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