Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:22
Open Multiple Links
Poster: foxaz
Dated: Tuesday June 29 2004 - 6:37:02 BST
Is there a way to assign multiple links?
I am using two IFrames, and it works to use one link and assign the target.
The code for opening two new pages in the two IFrames is easy with a regular HTML link code.
<a class="home" style="cursor:pointer; cursor:hand;" onClick="window.frames['main'].location ='http://www.governor.state.az.us/global/student_main.asp'; window.frames['side'].location ='http://www.governor.state.az.us/global/student_side.asp';">Student Resources</a>
Is there a way to use your navigational system to achieve the same result?
The link to the site I am working on is: http://www.richardfox.com/paul/final/paul.asp
To see it in action, click on the Constituent Services link, and then back on the Home link.
I prefer to put the Home link in your navigational system if I can find a solution.
Thanks,
Richard Fox
Poster: kevin3442
Dated: Wednesday June 30 2004 - 0:25:21 BST
Hi Richard,
I wrote a function way back when for use with v3 and regular frames that should also work with v5 and iframes. Here's the function
Code:
function loadMultiFrames()
{
if (arguments.length > 0)
{
for (var i=0; i<arguments.length; i++)
{
params = arguments[i].split("=");
if (params[0].length > 0 && params[1].length > 0) parent[params[0]].location = params[1];
}
}
}
{
if (arguments.length > 0)
{
for (var i=0; i<arguments.length; i++)
{
params = arguments[i].split("=");
if (params[0].length > 0 && params[1].length > 0) parent[params[0]].location = params[1];
}
}
}
Paste that function into the top of your menu_data.js file.
The loadMultiFrames() function will let you load any number of frames or iframes with a single menu item. I.e., you can load one frame, two frames, three frames, etc... as many as you like. The function takes a variable number of parameters, each separated from the next with a comma. Each parameter is a string specifying a frameName/URL combination. The parameter should be formatted as \"frameName=URL\" where frameName is the name of the frame whose content you want to change -- name as given in the <frameset> or <iframe> tag -- and URL is the URL you want to load into the specified frame. An equal sign (=) separates frameName and URL, with NO SPACES in the string (I didn't feel like eliminating white space). To include this function call in an aI() menu item, it is also best to use escaped double-quotes (\") around each frameName/URL string, like \"frameName=URL\" (otherwise, you'll get odd behavior in some browsers).
For exmaple, a menu item named "Go" that loads page1.htm into an iframe named "topframe", page2.htm into an iframe named "bottomframe", and page3.htm into an iframe named "sideframe" might look like:
Code:
aI("text=Go;url=javascript:loadMultiFrames(\"topframe=page1.htm\", \"bottomframe=page2.htm\", \"sideframe=page3.htm\");");
(all on one line... no wrapping)In your application, the Home menu item might look like this:
Code:
aI("text=Home;url=javascript:loadMultiFrames(\"main=http://www.governor.state.az.us/global/student_main.asp\", \"side=http://www.governor.state.az.us/global/student_side.asp\");");
(all on one line... no wrapping)
You can place a space after the comma between frameName/URL pairs if you like, or not.
Hope that helps,
Kevin
error on page when i use this function (version 5)
Poster: grimjim
Dated: Tuesday September 14 2004 - 10:10:06 BST
Hi Richard,
I'm wondering if you got this function to work.... I get an "error on page" message flashing up in the statusbar and nothing loads (IE5). I have also tried it in Firefox and nothing loads either....
The site is not currently online. I have followed the instructions exactly several times, and tried pasting your code directly into my menu_data.js file, changing only the frame names.....
Any help would be greatly apprecciated.
Cheers
Jim
Poster: kevin3442
Dated: Tuesday September 14 2004 - 19:35:35 BST
Hi Jim,
I posted a working demo for you. Dig around in the menu_data.js file and see if that helps you out.
Hope that helps,
Kevin
Thanks!
Poster: grimjim
Dated: Tuesday September 14 2004 - 20:31:43 BST
Thanks very much for the swift reply & assistance....
Cheers
Jim
Thanks for your help!
Poster: foxaz
Dated: Sunday September 26 2004 - 4:09:24 BST
Sorry it has taken me so long to reply and thank you all for your help.
Believe it or not, I am still working on the site. Government!?
I was done the middle of June, and then our committee (yikes) decided on some more features they wanted.
So, I finally got around to working on the solution you provided.
Until the site goes live, it is at: http://www.governor.state.az.us/paul.htm
We should go live sometime in October.
Hopefully!!!!!!!