Connecting Tech Pros Worldwide Forums | Help | Site Map

iframe help - change two iframes with one click

Arne Hendrickson
Guest
 
Posts: n/a
#1: Jul 20 '05
Can anyone tell me how to edit this script for "traditional frames" to work
with iframes?

SCRIPT language="JavaScript">
<!----hide
function change2()
{
parent.left_frame.location="page3.htm";
parent.right_frame.location="page4.htm";
}
//------>
</SCRIPT>

--
Arne Hendrickson
Set-Up Guys
arne@rogers.com



mscir
Guest
 
Posts: n/a
#2: Jul 20 '05

re: iframe help - change two iframes with one click


Arne Hendrickson wrote:[color=blue]
> Can anyone tell me how to edit this script for "traditional frames" to work
> with iframes?
> SCRIPT language="JavaScript">
> <!----hide
> function change2() {
> parent.left_frame.location="page3.htm";
> parent.right_frame.location="page4.htm";
> }
> //------>
> </SCRIPT>[/color]

Arne,

See if this works in the browsers you want to be able to use the code:

function chang2iframes() {
document.frames['frame1'].location.href="http://www.alertnet.org/"
document.frames['frame2'].location.href="http://www.reason.com/"
}

Change 'frame1' and 'frame2' to be the names of your iframes, and change
the href to the links you want to use.

If you didn't name your iframes use something like:

<IFRAME name="frame1" SRC="http://www.google.com" WIDTH="50%"
HEIGHT=400></IFRAME>
<IFRAME name="frame2" SRC="http://www.atomz.com" WIDTH="50%"
HEIGHT=400></IFRAME>

Anchor used to call function in body section:

<P><a onClick="chang2iframes()" style="cursor:pointer"><font
color="#0000FF"><u>click to change 2 frames</u></font></a></P>

Is this what you wanted (be prepared to get hassled about using frames)?

I'd recommend posting to ONE group only in future.

Mike


Evgeny
Guest
 
Posts: n/a
#3: Jul 20 '05

re: iframe help - change two iframes with one click


"Arne Hendrickson" <arne@rogers.com> wrote in message
news:1kkWb.331$cBH.110@news04.bloor.is.net.cable.r ogers.com...[color=blue]
> Can anyone tell me how to edit this script for "traditional frames" to[/color]
work[color=blue]
> with iframes?
>
> SCRIPT language="JavaScript">
> <!----hide
> function change2()
> {
> parent.left_frame.location="page3.htm";
> parent.right_frame.location="page4.htm";
> }
> //------>
> </SCRIPT>
>
> --
> Arne Hendrickson
> Set-Up Guys
> arne@rogers.com
>[/color]

call iframes by ID.

<iframe id="left_frame" ...><iframe>
<iframe id="right_frame" ...><iframe>

SCRIPT language="JavaScript">
<!----hide
function change2()
{
left_frame.location="page3.htm";
right_frame.location="page4.htm";
}
//------>
</SCRIPT>


Arne Hendrickson
Guest
 
Posts: n/a
#4: Jul 20 '05

re: iframe help - change two iframes with one click


I had already tried that but using the name attribute:

<iframe name="main" src="main.htm" height="430" align="left" width="610">

I tried adding the id attribute:

<iframe name="main" id="main" src="main.htm" height="430" align="left"
width="610">

as in your example but it didn't seem to help, then I tried one or the other
and both. Are the name and id attributes interchangeable? Is the problem
using both? Also my link is in an image map, but I tried it from a text link
as well which didn't seem to make a difference.



"Evgeny" <evgeny@yahoo.com> wrote in message
news:c0ip0f$jc6$1@weber.techno-link.com...[color=blue]
> "Arne Hendrickson" <arne@rogers.com> wrote in message
> news:1kkWb.331$cBH.110@news04.bloor.is.net.cable.r ogers.com...[color=green]
> > Can anyone tell me how to edit this script for "traditional frames" to[/color]
> work[color=green]
> > with iframes?
> >
> > SCRIPT language="JavaScript">
> > <!----hide
> > function change2()
> > {
> > parent.left_frame.location="page3.htm";
> > parent.right_frame.location="page4.htm";
> > }
> > //------>
> > </SCRIPT>
> >
> > --
> > Arne Hendrickson
> > Set-Up Guys
> > arne@rogers.com
> >[/color]
>
> call iframes by ID.
>
> <iframe id="left_frame" ...><iframe>
> <iframe id="right_frame" ...><iframe>
>
> SCRIPT language="JavaScript">
> <!----hide
> function change2()
> {
> left_frame.location="page3.htm";
> right_frame.location="page4.htm";
> }
> //------>
> </SCRIPT>
>
>[/color]


Evgeny
Guest
 
Posts: n/a
#5: Jul 20 '05

re: iframe help - change two iframes with one click


try this:

<SCRIPT>
function change2()
{
left_frame.src="page3.htm";
right_frame.src="page4.htm";
}
</SCRIPT>



"Arne Hendrickson" <arne@rogers.com> wrote in message
news:bb6Xb.494$s6M.257@news01.bloor.is.net.cable.r ogers.com...[color=blue]
> I had already tried that but using the name attribute:
>
> <iframe name="main" src="main.htm" height="430" align="left" width="610">
>
> I tried adding the id attribute:
>
> <iframe name="main" id="main" src="main.htm" height="430" align="left"
> width="610">
>
> as in your example but it didn't seem to help, then I tried one or the[/color]
other[color=blue]
> and both. Are the name and id attributes interchangeable? Is the problem
> using both? Also my link is in an image map, but I tried it from a text[/color]
link[color=blue]
> as well which didn't seem to make a difference.
>
>
>
> "Evgeny" <evgeny@yahoo.com> wrote in message
> news:c0ip0f$jc6$1@weber.techno-link.com...[color=green]
> > "Arne Hendrickson" <arne@rogers.com> wrote in message
> > news:1kkWb.331$cBH.110@news04.bloor.is.net.cable.r ogers.com...[color=darkred]
> > > Can anyone tell me how to edit this script for "traditional frames" to[/color]
> > work[color=darkred]
> > > with iframes?
> > >
> > > SCRIPT language="JavaScript">
> > > <!----hide
> > > function change2()
> > > {
> > > parent.left_frame.location="page3.htm";
> > > parent.right_frame.location="page4.htm";
> > > }
> > > //------>
> > > </SCRIPT>
> > >
> > > --
> > > Arne Hendrickson
> > > Set-Up Guys
> > > arne@rogers.com
> > >[/color]
> >
> > call iframes by ID.
> >
> > <iframe id="left_frame" ...><iframe>
> > <iframe id="right_frame" ...><iframe>
> >
> > SCRIPT language="JavaScript">
> > <!----hide
> > function change2()
> > {
> > left_frame.location="page3.htm";
> > right_frame.location="page4.htm";
> > }
> > //------>
> > </SCRIPT>
> >
> >[/color]
>
>[/color]


Closed Thread