View Full Version : One hyperlink Two urls

09-22-2005, 06:41 PM
Ok hi all
i am a basic user and was wanting to know if it is possible to have a hyperlink set so it opens two urls
i have a web page set out so that the user would select a link and it would open up the pages inside of iframes
can anyone shed some light on to how i may get it so that not olny does it change the main iframe but also a banner at the top with a different url e.g a html file with an image for title


09-23-2005, 02:47 AM
Not sure what you mean by that last bit:

a html file with an image for titleAnyways, two links for one can be done but, not with an ordinary hyperlink. You say you have two iframes. Give them each a name like:

<iframe name="banner" src="banner1.htm" width="350" height="150" frameborder="0"></iframe>and later on in the page:

<iframe name="main" src="main1.htm" width="650" height="450" frameborder="0"></iframe>Now, using javascript, we can target both on one click. Since I imagine the 'main' iframe is more important, we will make it the actual hyperlink and have the banner change use javascript:

<a href="main2.htm" target="main" onclick="banner.location.href='banner2.htm';return true;">Click for main2.htm</a>You should choose the lesser important link for javascript (the onclick event) because non javascript enabled browsers will not be able to use it.

09-23-2005, 04:31 PM
hmmm ok i tried that
and the banner doesnt change
any ideas?

09-23-2005, 05:54 PM

<a href="main2.htm" target="main" onclick="document.getElementsByName('banner')[0].location.href='banner2.htm';return true;">Click for main2.htm</a>
This is a bit of a hack, but:

Error: blah is not defined
Source File: javascript:alert(blah.innerHTML);
Line: 1

Error: document.blah has no properties
Source File: javascript:alert(document.blah.innerHTML);
Line: 1
in this:

<div name="blah">Blah</div>
There's probably some reason and easier way around this. I would use id here, usually.

09-23-2005, 06:44 PM
ok thanks ........ but does someone want to show me what to do with that one
:confused: :confused: :confused:

09-23-2005, 06:56 PM
Before you go trying to figure out Twey's solution which I haven't really looked at (it may be fine), consider this, mine works here in IE6, FF1.0.7 and OP8. If you are having a problem with it: