Frames Review


[figure]
Figure 1: framed page & HTML files
Consider the frames example to the right, in figure 1. This consists of three files (shown in the insert):
"framesintro.html", "frintro1.html", and "frintro2.html".
The first, framesintro.html, is that which is opened by the browser: it defines
  > how the browser window is partitioned, and
  > which files to load into each partition (frame).

The second file, frintro1.html, is the file that is loaded into the first frame, and the third file frintro2.html is loaded into the second frame.

Let's take these in order: The HTML for framesintro.html is shown in figure 2.
  <html>
  <head>
  <title>Frames Intro</title>
  </head>
  <frameset cols="30%,*">
  <frame src="frintro1.html" name="sidebar">
  <frame src="frintro2.html" name="main">
  </frameset>
  </html>
Figure 2: HTML for framesintro.html
Note:
  > there is no body tag
  > instead, there is a frameset tag

The <frameset> tag defines the frames in the document, in this case, one column using 30% of the navigator window and a second one using the remaining space ("*" -- note that the same effect could be obtained with the frameset tag <frameset cols="30%,70%">). Instead of a </body> tag, there is a </frameset> tag. In the frameset, the source files for two frames are defined with frame tags.


  <html>
  <head>
  <title>Frames Review</title>
  </head>
  <body bgcolor="white">
  <b>Intro Menu</b>
  <p>
  <a href="frintro2.html"
    target="main">Intro
    page</a>
  <p>
  <a href="frintro3.html"
    target="main">Workshop
    Frames page</a>
  etc.
  </body>
  </html>
Figure 3: HTML for frintro1.html
The <frame> tag defines:
  > the source document for the frame
  > a name for the frame

The source for the page frintro1.html is shown in Figure 3. This is the HTML file that is loaded into the left frame in Figure 1. Note:
  > This is a regular, complete, HTML file
  > The links (anchors) have a target attribute.
The target attribute of the link indicates which frame to load the linked file into -- the name is defined in the frame tag, as shown in Figure 2.

The file frintro2.html is also an ordinary HTML file similar to frintro1.html. It too may contain links with the target attribute.

Notes on the target attribute

  1. Possible targets are: target=
  2. Don't use a target attribute in documents that are not to be loaded in a frame. If not in a frame, they open a new browser window, which can be very annoying.

Top of Page


Frames Review
Last Modified: Fri May 31 10:01:30 EDT 2002
Do not Frame: glarose@umich.edu