Forum Moderators: open

Message Too Old, No Replies

Change content in multiple frames from one hyperlink

display 2 seperate pages(diff frames) one link

         

Deric

3:46 am on Jan 11, 2002 (gmt 0)



This may be an easy one (I am new at this). I was wanting to know if there is a way to display 2 different pages in 2 seperate frames by only clicking on one link? (ex Click on a link in the body frame & display a new page in the body & a different in the footer frame.)

ggrot

4:04 am on Jan 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can, but the only way I know to do it would involve javascript. What you need to do is have the link load one frame and then the document in that frame load the other frame on the onLoad event. I think the syntax would be: onLoad="framename.location.replace('newurl.htm');"

Be sure to replace framename with the correct frame to load the new file in. If I remember right, this also does a nice job of disabling the back button.

tedster

4:12 am on Jan 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Give your each of your frames an individual name attribute. Then define this function from the HEAD of your HTML:

function doTwo(pageA,pageB)
{
(parent.framename1.location=pageA);
(parent.framename2.location=pageB);
}

Then the links in the BODY section can look like this:

<a href="javascript:doTwo('newpage1.html','newpage2.html')">LINK - change both frames</a>

This should work whether you are changing the frame that contains the link itself, or two other frames in a multi-frameset.

tedster

4:19 am on Jan 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Overlapping post times!

ggrot's idea works for changing the frame content immediately onLoad - if that's what you need, then using the replace() method is a good idea.

But if you want to offer a link that changes two frames, I wouldn't use the replace() method. Back Buttons and frames are already confusing to the average user. The replace() method will change the history list, replacing the first state of the frameset with the new one. Then the Back Button won't take the vistor where they expected to go!