HTML The Definitive Guide (123 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
7.59Mb size Format: txt, pdf, ePub

Be aware, too, that unless you explicitly tell it not to, the browser lets users manually resize the individual frame document's columns and rows, and hence change the relative proportions each frame occupies in their frames display.

To prevent this, see the noresize attribute for the
tag. the sidebar ""

12.3.1.2 Controlling frame borders and spacing
The popular browsers provide attribute extensions that you may use to generally define and change the borders surrounding the frames in a frameset. The HTML 4.0 standard prefers instead that you include these border-related display features via tag attributes.

Both Internet Explorer and Netscape use the frameborder attribute to disable or explicitly enable frame borders.

(By default, every frame in a frameset as well as the frameset window itself is rendered with a 3D border; see Figure

12.1
.) The two browsers' documentation disagree about the particular values for the frameborder attribute, but both acknowledge the other's conventions. Hence, setting the value of frameborder to 0 or no turns borders off
(see Figure 12.2
); 1 or yes turns borders on.

Figure 12.2: The frameborder attribute lets you remove the borders between frames
Internet Explorer and Netscape do disagree, however, as to how you may control the thickness of the borders. Internet Explorer supports the framespacing attribute, whose value is the number of pixels you want between frames (see
Figure 12.2
). The attribute affects all frames and framesets nested within the current frameset as displayed by Internet Explorer. In practice, you should set it once on the outermost to create a consistent border appearance for all of the frames in a single page.

Netscape accepts only the border attribute to define the border width, with an integer value in pixels. Like Internet Explorer, Netscape lets you include the frameborder attribute with any tag, affecting all nested frames and framesets. Unlike Internet Explorer, Netscape lets you include the border attribute only in the outermost , ensuring that all frame borders are the same width within that .

Since browsers ignore unsupported attributes, it is possible to define frame borders so that both browsers do the right thing. Just make sure to use the same framespacing and border values.

Finally, with Netscape you can control the color of the frame borders using the bordercolor
attribute (Figure

12.3
). It accepts a color name or hexadecimal triple as its value. A complete list of color names and values can be
found in Appendix F, Color Names and Values
.

Figure 12.3: Netscape accepts border and bordercolor attributes to control the color and spacing
between frames

12.3.1.3 Frames and JavaScript

Internet Explorer and Netscape, as well as the new HTML 4.0 standard, support JavaScript-related event handlers that let your frame documents react when they are first loaded and when the frame window gets resized (onLoad); unloaded from the browser by the user (onUnload); when the window containing the frameset loses focus, such as when the user selects another window (onBlur); or when the frameset becomes the active window (onFocus).

Included as attributes, these event handlers take quote-enclosed lists of JavaScript commands and function calls as their value. For example, you might notify the user when all the contents have been loaded into their respective frames of a lengthy frameset: These four attributes may also be used with the tag. We cover JavaScript Event handlers in more detail in
section Section 13.3.3, "JavaScript Event Handlers"
in
Chapter 13.

12.3.1.4 Other attributes
Like most of the other HTML 4.0 standard tags, the tag honors four of the standard attributes: class, style, title, and id.

Use the class attribute to associate a predefined style class with this frame and, via style inheritance, its content.

Alternatively, use the style attribute to define a style inline with the tag. We cover styles more completely in Chapter 9, Cascading Style Sheets.

The id attribute creates a unique identifier for the frame, while title creates a title for the frame that might be
presented to the user or used by a nonvisual browser. [The id attribute, 4.1.1.4]
[The title attribute, 4.1.1.5]

12.3.2 Nesting Tags

You can create some elaborate browser displays with a single , but the frame layout is unimaginative.

Instead, create staggered frames and other more complex layouts with multiple tags nested within a top-level in the frame document.

For example, create a layout of two columns, the first with two rows and the second with three rows (
Figure 12.4
), by nesting two tags with row specifications within a top-level that specifies the columns:






Figure 12.4: Staggered frame layouts use nested tags
12.2 Frame Tags

12.4 Frame Contents

Other books

Velodromo De Invierno by Juana Salabert
Harry Flashman by George MacDonald Fraser
Johnny Tremain by Esther Hoskins Forbes
Tin Lily by Joann Swanson
The Gift: A Novella by Sandra Marton
La noche de los tiempos by Antonio Muñoz Molina