spacer
Yehuda Shiran April 8, 2000
Changing Frames
Tips: April 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

In one of our previous columns we built a frame based navigational site in which links in a navigation frame opened both a new page in the main content frame and an additional page in a third frame. The first five links in the example point to five of our past columns. Clicking one of them will display the first page of the column in the left frame and one of the column's code pages in the bottom right frame. Here's what the link for Column 16 looks like:

<A HREF="topright.html" 
   onClick="changePage('../column16/index.html', '../column16/code1.html')">
   <B>[16] Dynamic Tooltips</B></A>

Notice that the HREF value is the frame itself, HREF="topright.html". We could have used javascript:void(0) and get the same effect of triggering the link to cause side effects that do not include changing the link itself. The event handler changePage() accepts two pages as its arguments and displays them in the left and bottom right frames:

function changePage(pageIndex, pageCode) {
  parent.parent.frames[0].location = pageIndex;
  parent.frames[1].location = pageCode;
}

Notice the hierarchy of frames here. In order to get to the left frame, we need to go up two levels: one to the parent of the current frame (right column) and one to its parent (top window). In order to get to the right bottom frame, we need to go up to the parent of the current frame (right column) and then choose the second frame (frames[1]).

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:


The Network for Technology Professionals

Search:

About Internet.com

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

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Workers Say Telework Is More Productive, Bosses Not So Sure · Kingston Debuts Power-Saving Memory Upgrades · Social Networking is King: Facebook Edges Google