Frames - Syntax

Frames are generated by three things:


Frame Document

In a frame document the <BODY> tag is replaced by one or more <FRAMESET> tags. These define the groups of frames within a document.

	<HTML>

	<HEAD>

	</HEAD>

	<FRAMESET>

	  <NOFRAME>

	  frame challenged browsers will see this

	  </NOFRAME>

	  <FRAME src="a url">

	  <FRAME src="another url">

	</FRAMESET>

	</HTML>

The frames that are complete HTML documents, each with their own colour styles and background images.


FRAMESET

<FRAMESET [ROWS=valuelist] [COLS=valuelist]>... </FRAMESET>

The FRAMESET tag can contain FRAME , NOFRAME and other FRAMESET tags. It will be ignored if it is preceded by any tag that would normally appear in the BODY tag of a HTML document.

The ROWS and COLS attributes takes a comma separated list of values. These can be

The number of rows and columns is implicit in the number of elements in each list. Since the total height and width of all the all the rows must equal the dimensions of the window, heights and widths might be calculated to achieve this.

A missing ROWS or COLS attribute is interpreted as a single row arbitrarily sized to fit.


Value list

This is a comma separated list of numbers. The format of the numbers can be one of

FRAME

<FRAME SRC="url" [NAME={_blank|_self|_parent|_top|name}] [MARGINWIDTH=pixels] [MARGINHEIGHT=pixels] [SCROLLING={yes|no|auto}] [NORESIZE] >

Defines a single frame in a frameset.

SRC
Sets the url of the document that will be displayed within the frame. The frame will be blank unless the url is set.

Documents within frames can also contain frames. What you get then is nested frames! Colour styles and background imagery are also set on a per document basis within the frames.

NAME
This attribute is used to identify a frame in this document so that documents can be displayed in it from other frames.

some NAMEs are reserved
_blank Always load this link into a new, unnamed window.
_self Always load this link over yourself.
_parent Always load this link over your parent. (becomes self if you have no parent).
_top Always load this link at the top level. (becomes self if you are at the top).
All other names starting with '_' will be ignored.

MARGINWIDTH and MARGINHEIGHT
sets the distance in pixels between the body of th frame and its edges. Must be a number greater than 1.
SCROLLING="yes|no|auto"
enables the scroll bar on a frame.
NORESIZE
does not allow the frame to be resized

NOFRAMES

HTML within this tag will be only displayed by frame-challenged browsers and can be used to put annoying messages such as

	<NOFRAMES>

		Err sorry guys, this document can only be viewed by a 

		frame capable viewer.



		for you unspeakable people without frames, here's a 

		non-frames version of the document.

		....

	</NOFRAMES>


Examples

This example compares Frame syntax and TABLE syntax, and will show the HTML source used to display the layout below.


Targets

The <A ..> tag now has an extra parameter called TARGET

  <a href="url" TARGET="frame_name">...</a>

As you might guess, this tells the browser to display the contents of the url in the named frame frame_name. This is the final piece of the puzzle to frames

If you have problems with this tag, make sure that the TARGET parameter is in CAPITALS.