magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 04 > Help Desk  

Help Desk

By Jeff Keller, Guest Editor

One Link, Many Frames

Dear Help Desk,
Is there a way to load two different frames with one hyperlink?
- Joe

Dear Joe,
There is indeed, though you'll have to write a little JavaScript to do so. Before you do that, be sure to note the names of the frames that you want to change. For this example, let's say that your page has three horizontal framesınamed "top," "middle," and "bottom". Assume that when you click on a link in the top frame, you want new data to load into the middle and bottom frames.

You'll need to insert this JavaScript code in the <HEAD> section of the HTML file that has your link:

<script language="javascript">
 function loadLinks
  (URL1, Frame1, URL2, Frame2) {

  parent.frames[Frame1]
    .location = URL1
  parent.frames[Frame2]
    .location = URL2
}
</script>


This script will load the URL1 file (or URL) into the frame you designate as Frame1. Then URL2 will load into the frame designated as Frame2. Finally, you need to call this script from the link in question, like so:

<a href="http://www.newarchitectmag.com/documents/s=5197/new1013637358/javascript:loadLinks(
  'newmiddle.html','middle',
  'newbottom.html','bottom'
  ">Click Here!</a>

Make sure you place the JavaScript in the HTML file where you want the navigation to take place. In this case, it would be placed in the same file as the "Click Here!" link. Keep in mind that this method works only when the frames are in the same frameset.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2