April 10, 2000 - Juggling Frames & Images
April 10, 2000 Juggling Frames & Images Tips: April 2000
Yehuda Shiran, Ph.D.
|
<A HREF="topright.html" onClick="loadLeftAndSwitch()"><B>Load a frameset and switch upper image</B></A>
The loadLeftAndSwitch()
event handler is defined as:
function loadLeftAndSwitch() {
parent.parent.frames[0].location = "leftframeset.html";
top.setTimeout('parent.parent.frames[0].frames[0].document.images[0].src = "docjslib.gif"',200);
}
Notice the hierarchical position of the top left frame. We have to go up two levels to the top window (parent.parent
), and then go down to the first frame (left column), and then again to its first frame (top left frame). Also notice the delay we need to keep between loading the frames and changing one of the images inside one of the frames.
Learn more about frames and see a demonstration of the above in Column 36, JavaScript and Frames, Part I .