Can a button link to multiple url's?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
fotops
Advanced
Advanced
Posts: 10
Joined: Mon Jan 05, 2004 10:14 pm
Contact:

Can a button link to multiple url's?

Post by fotops »

I would like to have a link point to two iframes on a page.

One changes the headline art and one changes the content for the page.

So a given "button" would have two url links, each with a "target".

Any chance?

Thanks.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I can't really visualize how you'd put two links on one button, how in the world would it know which one was clicked? But, I think you could make a button of two images that you put together so they look like only one. Put them in a little table with border=0, cellpadding=0, cellspacing=0. Then you could link to either side if they meet at the vertical center or in the top and bottom if they meet at the horizontal center. Kind of like an image map? You might also be able to create buttons with css and do the borders in such a way that it looks like one button, but is really two again with the links attached each to it's own.

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

Post by kevin3442 »

You could make a javascript function that would take two URLs as parameters, then change the content of the two iframes to the two passed urls. Call the function from the menu item.

Cheers,

Kevin
fotops
Advanced
Advanced
Posts: 10
Joined: Mon Jan 05, 2004 10:14 pm
Contact:

Post by fotops »

Thanks for your suggestions, I have found some javascript functions for linking to multiple <iframes>'s and by using the "clickfunction" I can integrate a javascript function to show/hide div's (layers).

The possible combinations are limitless!!!

here is some of the coding...

Code for javascript linking to multiple <iframe>'s uses this function:

Code: Select all

function loadFrames(frame1,page1,frame2,page2) {
eval("parent."+frame1+".location='"+page1+"'");
eval("parent."+frame2+".location='"+page2+"'");
}
The code to activate the multi-links is:

Code: Select all

url=javascript:loadFrames('FrameA','http://www.google.com','FrameB','http://www.yahoo.com')
This could easily expand to however many iframes you need!



Milonic's "clickfunction" coding to show/hide div's (layers):
Uses two macromedia dreamweaver functions...

Code: Select all

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
} 
You can activate it with the "clickfunction":

Code: Select all

clickfunction=MM_showHideLayers('LayerA','','hide','LayerB','','show','LayerC','','hide','LayerD','','hide','LayerE','','hide','LayerF','','hide','LayerG','','hide')
Cheers!

fotops
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Always use the [code][/code] tags when posting code. As you can see, your post leaves something to be desired!
John
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Thanks for posting the information, fotops

Ruth
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi fotops,

Not sure if you'll see this, but could you possibly give me an example of this. I'm not real good at using functions. I understand the part about using the clickfunction in the menu aI string. How do I set up the divs on the page so they are not showing and then are called to show with the function?

Ruth
Post Reply