spacer
Yehuda Shiran April 6, 2000
Controlling Frames
Tips: April 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

One of the capabilities of frame sets is the ability to control multiple frames from a single frame. There are two basic ways to do it. The first one is a combination of an HREF and an event handler assignment:

<A HREF="frame4new.html" TARGET="bottomrow" 
onClick="parent.frames[1].location.href = 'frame4new.html'; 
return true;">Multiple Load #1</A>

In this example, we first load frame4new.html (HREF="frame4new.html") at the bottom row frame (TARGET="bottomrow"). Then, we use the onClick event handler to load the file frame4new.html in frame no. 1:

onClick="parent.frames[1].location.href = 'frame4new.html'; return true";

The second approach is to include all operations in the HREF's javascript: URL:

<A HREF="javascript:void(parent.frames[1].location.href='frame4new.html');
void(parent.frames[2].location.href='frame4new.html');">Multiple Load #2</A>

Here we assign frame4new.html to both frame 1 and frame 2. Although this technique doesn't degrade as well as the first for non-javascript enabled browsers, it is more straightforward. Familiarize yourself with the javascript: URL and its usage. We have covered this subject in Column 34, for example. Remember to return void from your JavaScript statements, as explained in Column34.

Learn more about frames 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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint