Entry
How do I create a link that changes the content of two or more frames?
How do I create a link that changes the content of two or more frames?
How do I create a link that changes the content of two or more frames?
Aug 13th, 2000 23:34
Rey Nuņez, Ben Gordon,
One easy method is to link to a new frameset page using TARGET="_top".
Any documents or images common to both framesets will be loaded quickly
from the cache.
You can change two frames at once by using scripting within the anchor:
<A HREF="file1.html" TARGET="frame1"
onClick="parent.frame2.location.href='file2.html'">
The HREF and TARGET on the first line specify the update for one frame,
and the second line includes a script that changes the second frame.
Substitute the appropriate frame names in each case. Note that you may
need other changes in the script, depending on the structure of your
page.
You can also use scripting to change selected frames and (optionally)
to perform other functions from a single click, as follows:
<A HREF="javascript:load
('fname1','target1.html','fname2','target2.html')"
<SCRIPT Language = "JavaScript">
<!--
function load(f1,p1,f2,p2){
eval("parent."+f1+".location='"+p1+"'");
eval("parent."+f2+".location='"+p2+"'");}
//-->
</SCRIPT>
Substitute the appropriate frame names (fname1, fname2) and the target
documents (target1.html, target2.html) in each case.