home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


HTML: The Definitive Guide

Previous Chapter 15
Tips, Tricks, and Hacks
Next
 

15.7 Multiple Frames in One Link

Loading a new document from a hyperlink is a snap, even if you put the new document into an alternative frame or window from its hyperlink parent. Occassionally, though, you'll want to load documents into two frames when the user clicks just one link. With a bit of trickery you can load two or more frames at one time, provided they are arranged a certain way in the browser window.

Consider this frame layout:

<frameset rows=2>
  <frameset cols=2>
    <frame name=A>
    <frame name=B>
  </frameset>
  <frameset>
    <frame name=C>
    <frame name=D>
  </frameset>
</frameset>

If someone clicks a link in frame A, the only thing you can do is update one of the four frames. Suppose you wanted to update frames B and D at the same time?

The trick is to replace frames B and D with a single frame, like this:

<frameset cols=2>
  <frameset rows=2>
    <frame name=A>
    <frame name=C>
  </frameset>
  <frame name=BD>
</frameset>

Aha! Now you have a single target in which to load a single document, frame BD. The document you load should contain the original frames B and D in one column, like this:

<frameset cols=2>
  <frame name=B>
  <frame name=D>
</frameset>

The two frames will fill frame BD. When you update frame BD, both frames will be replaced, giving the appearance of two frames being updated at one time.

The drawback to this is that the frames must be adjacent and able to be grouped into a single document. For most pages, though, this solution works fairly well.

We've only scratched the surface of HTML tips and tricks here. Our advice: keep hacking!


Previous Home Next
Creating New Windows Book Index HTML Grammar

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell