Linking Simultaneously to Multiple Iframes

liunx

Guest
Simple Question, Is there any way to have a link that, when clicked, loads two different Iframes on the same page? Maybe some kind of JAva script even? Please help!!<br />
<br />
Thanks - andy<!--content-->With the same page in each or different pages?<!--content-->If you have IFrames like this:<br />
<br />
<iframe id="page1" src=http://www.webdeveloper.com/forum/archive/index.php/"page1.html"><br />
<iframe id="page2" src=http://www.webdeveloper.com/forum/archive/index.php/"page2.html"><br />
<br />
you can use the following code to change both at once:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:top.page1.src ='page3.html';top.page2.src = 'http://www.webdeveloper.com/forum/archive/index.php/page4.html'">Click Me</a><br />
<br />
This Javascript code changes page1 to page3 and page2 to page4.<br />
<br />
Hope this helps<br />
<br />
Adam<!--content-->That will fail one in ten times. Your better bet is create another page that "hard codes" the content of those two IFRAMES and then have your link load that page at the top. Or as an alternate:<br />
<br />
<script type="text/javascript"><br />
<!--<br />
document.write('<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">Click Me</a>');<br />
document.links[document.links.length-1].onclick = function () {top.page1.src = 'http://www.webdeveloper.com/forum/archive/index.php/page3.html'; top.page2.src = 'http://www.webdeveloper.com/forum/archive/index.php/page4.html'; return false}<br />
// --><br />
</script><br />
<noscript><br />
<p>You will need to click both of these:</p><br />
<ul><br />
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"page3.html" target="page1">Navigation</a></li><br />
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"page4.html" target="page2">Content</a></li><br />
</ul><br />
</noscript><!--content-->While Mr. Clark's method ought not to be used because of the reasons he has rightly mentioned, it does have one great advantage over Mr. Gundry's method. Mr Gundry's method will also not work with version 6 browers.<!--content-->Thank You all for the advice, I am testing both methods now.<!--content-->
 
Back
Top