View Full Version : How do you make one link go to two different destinations in two different iframes?
cruelxlovely
06-21-2005, 03:02 PM
Let me explain. You click on the link. You get to www.a.com in one iframe, and www.b.com in the other. Mmhmm. I want the code. How do you do itttt.
cruelxlovely
06-21-2005, 03:04 PM
Yeah okay. Email me if you know how to.... cruel.lovely@gmail.com.
The only way is to use a client-side scripting language. In Javascript:
<a href="javascript:void();" onclick="document.getElementById('idOfFrameA').location = 'www.a.com'; document.getElementById('idOfFrameB').location = 'www.b.com';">Link Text</a>
... and create two frames with ids.
By the way, if you can possibly avoid it... don't use iframes.
obifenobi
07-12-2005, 05:03 PM
Hi all first time post...
This is the exact problem Im having but I cant seem to get this to work (Im not a very good programmer ;)) Heres my code:
<tr>
<td width="2" valign="middle" class="text1">></td>
<td width="103" valign="middle" class="text1"><a href="javascript:void();" onclick="document.getElementById('middle').location = 'includes/news.htm'; document.getElementById('frame').location = 'link.htm';" class="text1">Home</a>
</td>
</tr>
Can someone give me some pointers?
href="javascript:void();"
You should try to avoid using useless hrefs if possible. In this case, a better idea would probably be to link to the most prominent of the pages linked to.
Also, consider using location.href instead of location.
You should include the code for the frames themselves (frame and middle). If you haven't got these frames, then that's the problem.
Also, if you're using frames instead of iframes, you shouldn't access them via document.getElementById(); you should use parent.framename instead.
obifenobi
07-13-2005, 03:20 PM
You should try to avoid using useless hrefs if possible. In this case, a better idea would probably be to link to the most prominent of the pages linked to.
Also, consider using location.href instead of location.
You should include the code for the frames themselves (frame and middle). If you haven't got these frames, then that's the problem.
Also, if you're using frames instead of iframes, you shouldn't access them via document.getElementById(); you should use parent.framename instead.
Ok, apologese, as I said, Im not very good at programming!! Have I not put the code for middle and frame in already? (everything has been created). And what exactly do you mean by 'useless' href's? I was only copying the code you gave, does this have to be changed to suit me specifically? and if so, how??
Thankyou!
PS I also need it to work in Firefox too.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.