The Wayback Machine - https://web.archive.org/web/20081120023429/http://www.webreference.com/html/tutorial14/5.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 14 / 5

index1234567exercises1

Tutorial 14: You've been Framed, Part I

Developer News
HP to Microsoft: Thanks for Nothing
iPhone Remains Left Out as Android Scores Flash
The Year of Living the OpenSocial

Loading new documents into an existing frameset

After a document is loaded into a frame, any subsequent documents loaded by following links in that document are displayed in the same frame. This can be nice since you can have a fixed "decor" around your main page that supplies standard services. However, in order for this to be truly useful, you need to be able to display the tail of a hyperlink from one frame in another frame. This makes it possible, for instance, to have a fixed table of contents in one frame, with links to sections of a multi-page text, and displaying the relevant section every time such a link is clicked on by the user.

This is accomplished by the TARGET attribute. The TARGET attribute applies to the A, LINK, AREA, FORM, and BASE elements.

Target frame attribute

TARGET (Frame target)
Specifies the name of the frame in which the link's tail will be displayed. Alternatively, can be used to specify the name of a browser window in which to display the document, or may be one of the special frame targets (see text)

When TARGET is set for an A, LINK, or AREA element that specifies a hyperlink, the destination of this link is loaded in the frame named in the value of the attribute. You can also set this attribute on a FORM element so that the ACTION URL is loaded in a different frame. For example, in the framed HTML with Style front page we saw above, the links in the sidebar that lead to the Tools, Tutorials, Style Watch and About pages are loaded in the central frame. Recall our frameset document:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"
"http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML>
 <HEAD>
  <TITLE>HTML with Style - WebReference.com</TITLE>
 </HEAD>
 <FRAMESET ROWS="170,*,17%">
  <FRAME NAME="ad" SRC="example2.html" NORESIZE SCROLLING="no">
  <FRAMESET COLS="250,*">
   <FRAME NAME="sidebar" SRC="example3.html">
   <FRAME NAME="main" SRC="example4.html">
  </FRAMESET>
  <FRAME NAME="footer" SRC="example5.html" NORESIZE SCROLLING="no">
 </FRAMESET>
</HTML>

The frame called sidebar initially holds the document example2.html. By default, a link in this document would be of the following form:

<A HREF="watch/">Style Watch</A>

If the user followed this link, the document found by dereferencing the URL watch/ would be loaded in the sidebar frame. However, we can use the following syntax instead:

<A HREF="watch/" TARGET="main">Style Watch</A>

This would load the Style Watch page in the frame called main instead. You can try this by going back to the frameset and clicking on one of the links in the sidebar.

You can also set the default frame target for a document by setting the TARGET attribute on the BASE element. The value of this attribute will be the default target for all links in the document instead of the current frame. You can override this value by setting the TARGET attribute for individual links.

index1234567exercises1

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Building Command Line Utilities with Python · fring Brings Mobility to Junction Networks' OnSIP · Another Big Win for Wi-Fi Positioning

URL: http://www.webreference.com/html/tutorial14/5.html

Produced by Stephanos Piperoglou
Created: June 30, 1999
Revised: June 30, 1999

Morty Proxy This is a proxified and sanitized view of the page, visit original site.