Forum Moderators: open

Message Too Old, No Replies

One link to change three frames - how?

         

rare_fate

5:23 am on Apr 19, 2004 (gmt 0)

10+ Year Member



I need a link that will open 3 links to 3 separte targets. Anyone know a short code to enable such a thing.

rare_fate

5:33 am on Apr 19, 2004 (gmt 0)

10+ Year Member



well simple answer is....

<a href="#" onclick="window.open('link1.htm', 'target1'); window.open('link2.htm', 'target2'); window.open('link3.htm', 'target3');">*Text or Image*</a>

tedster

6:50 am on Apr 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, this requires a javascript solution - there's no way for a single link to open more than one document with HTML alone.

I'm not sure from your second post whether you've got an answer now or now. It takes a bit more for the code you have to work.

First, in your external js file (or in the head section) define the function loadThree():

function loadThree(frame1,page1,frame2,page2,frame3,page3) {
eval("parent."+frame1+".location='"+page1+"'");
eval("parent."+frame2+".location='"+page2+"'");
eval("parent."+frame3+".location='"+page3+"'");
}

Then in the HTML anchor,

<a href="javascript:loadThree('frameA','pagea.html','frameB','pageb.html','frameC',pagec.html')">Load Three Pages</a>

Notice that I've used 'frame1' for a variable and 'frameA' for the frame's actual name. Similarly, I've used 'page1' for the variable, and 'pagea' for the page's actual name.

When you change more than one frame, the BACK button will only take the screen back one frame at a time, not all at once. If that's a problem, the only workaround I can think of is forgetting the Javascript and having the link load an entirely new frameset, with the individual frames holding the new HTML documents (and the old documents, for any frames that will remain the same)