spacer
Yehuda Shiran April 10, 2000
Juggling Frames & Images
Tips: April 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

The following link loads a frameset and switches one of its images:

<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 .


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business