Previous Page
Next Page

Chapter 5. Frames, Frames, and More Frames

Frames are a useful feature of HTML, though they have fallen somewhat out of favor over the past few years. In this chapter, we'll demonstrate how to harness the power of JavaScript to make frames even more useful.

A frame consists of at least three pages of HTML. The first, called the frameset, sets up the dimensions of each of the child frames. The frameset is referred to in JavaScript as top or parent. The remainder of the pages fit into the panes that the frameset has created and are the child pages. These can be named anything you choose. Figure 5.1 shows a frameset that creates two child frames, "left" and "content".

Figure 5.1. Layout of a frameset that contains two frames, "left" and "content".


Table 5.1. Just Enough HTMLFrames

Tag

Attribute

Meaning

frameset

 

Specifies that the page consists of two or more framed pages; contains the frame tags that specify the particular pages.

 

cols

The column dimensions (proportional or fixed), in pixels, of each frame.

frame

 

The location and attributes of each framed page.

 

id

Used by JavaScript to refer to one of the pages in the frameset.

 

name

An alternate method by which JavaScript can refer to one of the pages in the frameset.

 

src

The physical location (i.e., the URL) of the page loaded into the frame.

iframe

 

An internal frame, displayed inside the calling HTML page.

 

id

JavaScript uses this to refer to the iframe.

 

name

JavaScript can alternately use this to refer to the iframe.

 

src

The URL of the iframe page.

 

width

The width (in pixels or percent) of the iframe.

 

height

The height (in pixels or percent) of the iframe.

 

align

Aligns the iframe right or left.

 

frameborder

Displays a border around the iframe.



Previous Page
Next Page