How do I load a page in another frame?

When you use frames on your site there comes a time when you must redirect a link to another frame then the one in which the link is. How do you do this?

First, in the page where you define the layout of the frames you must give each frame a name, using the NAME attribute of the FRAME element, with something like this:

<FRAMESET cols="200,*">
 <FRAME src="menu.html" name="menu">
 <FRAME src="start.html" name="contents">

Now add the TARGET attribute to every link that needs to be loaded in another frame. So a link from the menu bar to show a page in the other frame can be created like this:

<A href="newpage.html" target="contents">View the page</A>

Check the description of the TARGET attribute of the A element for an explanation of the magic target names which can target a link to a new window, or break out of the frames page.

Back to the FAQ main page

  Copyright © 1996 - 1999 Rob Schlüter,   (last updated 1999/03/01)