Read HTML The Definitive Guide Online
Authors: Chuck Musciano Bill Kennedy
Chapter 12
Frames
12.5 The Tag
A frame document has no
Function:
Supply content for nonframe-capable browsers Attributes:
CLASS ONKEYUP
DIR ONMOUSEDOWN
ID ONMOUSEMOVE
LANG ONMOUSEOUT
ONCLICK ONMOUSEOVER
ONDBLCLICK ONMOUSEUP
ONKEYDOWN STYLE
ONKEYPRESS TITLE
End tag:
Contains:
body_content
Used in:
frameset_content
Use the tag only within the outermost tag of a frame document. The content inside the tag and its required end tag () is not displayed by any frame-capable browser, but is displayed in lieu of other contents in the frame document by
browsers that do not handle frames. The contents of the tag can be any normal HTML
body content, including the
Although this tag is optional, experienced HTML authors typically include the tag in their frame documents with content that warns a nonframe-capable browser user that they're missing the show. And smart authors will give those users a way out, if not direct access to the individual documents that make up the frame document contents. Remember our first frame example in thischapter? Figure 12.5shows what happens when that frame document gets loaded into an old version of Mosaic.
Figure 12.5: A message in a nonframe-capable browser
Sorry, this document can be viewed only with Netscape Navigator version 1.2 or later.
Take this link to the first HTML document in the set.
The reason works is that most browsers are extremely tolerant of erroneous tags and incorrect documents. A nonframe browser simply ignores the frame tags. What's left, then, is the content of the tag, which the browser dutifully displays.
If your browser strictly enforces some version of HTML that does not support frames, it may simply display an error message and refuse to display the document, even if it contains a tag.
12.5.1 Attributes
There are no attributes specific to the tag, but you can use any of the sixteen standard HTML 4.0 attributes: class and style for style management, lang and dir for language type and display direction, title and id for titling and naming the enclosed content, and any of the event attributes for user-activated JavaScript processing within the tag. [The dir attribute,
3.5.1.1] [The lang attribute, 3.5.1.2][The id attribute, 4.1.1.4][The title attribute, 4.1.1.5][Inline
Styles: The style Attribute, 9.1.1][Style Classes, 9.2.4][JavaScript Event Handlers, 13.3.3]
12.4 Frame Contents
12.6 Inline Frames
To this point, our discussion has centered around frames that are defined as part of a frameset. A frameset, in turn, replaces the conventional
Internet Explorer and the new HTML 4.0 standard let you do things a bit differently: You also can define a frame that exists within a conventional document, displayed as part of that document's text flow. These frames behave a lot like inline images, which is why they are known as inline frames.
12.6.1 The Tag
Define an inline frame with the tag. The tag isnotused within a tag. Instead, it appears anywhere in your HTML document that an tag might appear. The tag defines a rectangular region within the document in which the browser displays a separate HTML document, including scrollbars and borders.