PDA

View Full Version : Javascript for a link to open iframes


FredT
06-15-2008, 05:06 PM
Hi,

I was wondering if there was a way to make a link change two different iframes.

This will change the content in one iframe, but only one.

<a href="whatever.html" target="iframe1">Click here</a>

Is there some javascript that can do something like this?

<a onClick="open()">Click here</a>

<script type="text/javascript>
function open() {
open up whatever.html in iframe1
open up whatever2.html in iframe2
and even open up whatever3.html in iframe3 if I want,
possibly 4,5,6 however many I want in this list...
you get the picture.
}

Can anyone translate this into real javascript? :)

Thanks

FredT
06-15-2008, 05:38 PM
Never mind!

This worked:

document.getElementById('iframe1').src = 'whatever.html';