home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Table 7.1 Attributes of the <FRAME> Tag

Attribute Purpose

FRAMEBORDER=1|0 Turns frame borders on or off
MARGINHEIGHT=n Specifies the amount of whitespace (in pixels) to be left at the top and bottom of the frame
MARGINWIDTH=n Specifies the amount of whitespace (in pixels) to be left along the sides of the frame
LONGDESC=”url” Provides the URL of a document that gives a more detailed description of what’s in the frame; useful for nonvisual browsers
NAME=”name” Gives the frame a unique name so it can be targeted by other documents
NORESIZE Disables the user’s ability to resize the frame
SCROLLING=YES|NO|AUTO Controls the appearance of horizontal and vertical scrollbars in the frame
SRC=”url” Specifies the URL of the document to load into the frame

To place content in each of the regions you created at the end of the previous section, you can use the following HTML:

<FRAMESET COLS=”108,*”>  <!-- Split screen into two columns. -->
   <FRAME SRC=”toc.html”>   <!-- Placeholder for table of contents. -->
   <FRAMESET ROWS=”92,*”>  <!-- Split column 2 into two rows. -->
      <FRAME SRC=”logo.html”>    <!-- Placeholder for logo. -->
      <FRAME SRC=”content.html”> <!-- Placeholder for changing content -->
     </FRAMESET>
</FRAMESET>

The resulting screen appears in Figure 7.7.

Certainly, the SRC attribute in a <FRAME> tag is essential. Otherwise the browser would not know where to look for the content that is to go into the frame.


FIGURE 7.7  Each frame in your layout should have a corresponding <FRAME> tag that populates it with content or a <FRAMESET> tag that subdivides it further.

You’ll probably find that you frequently use the other attributes as well. In particular, MARGINWIDTH and MARGINHEIGHT enable you to set up left and right (MARGINWIDTH) and top and bottom (MARGINHEIGHT) margins within each frame. Putting a little whitespace around the content in each frame enhances readability, especially when you have FRAMEBORDER set to zero.

The NORESIZE and SCROLLING attributes are handy when you want to modify the user-controlled aspects of a frame. Recall that a user can change the size of a frame by clicking a border of a frame and dragging it to a new position. NORESIZE is a Boolean attribute that, when present in a <FRAME> tag, suppresses the user’s ability to change the size of the frame. You might want to do this if it is imperative that the size of a frame not change so that it can always accommodate a key piece of content. SCROLLING can be set to YES if you always want horizontal and vertical scrollbars on the frame, and to NO if you never want scrollbars. The default value of SCROLLING is AUTO, in which the browser places scrollbars on the frame if they’re needed and leaves them off if they’re not needed.


CAUTION:  

Be careful about setting SCROLLING to NO. You should do this only if you are absolutely sure that all the content in a frame will always be visible. Otherwise, users might find themselves in a situation where content runs off the side or bottom of a frame, and they have no way to scroll around to see it.


Targeting Named Frames

Probably the trickiest thing about frames is getting content to appear where you want it to appear. This is where naming the frames you create becomes critical. By naming the changing content frame “main,” you can then use the TARGET attribute in all your <A> tags to direct all hyperlinked documents to be loaded into that frame:

<FRAMESET COLS=”108,*”>  <!-- Split screen into two columns. -->
   <FRAME SRC=”toc.html”>
   <FRAMESET ROWS=”92,*”>  <!-- Split column 2 into two rows. -->
      <FRAME SRC=”logo.html”>
      <FRAME SRC=”content.html” NAME=”main”>
     </FRAMESET>
</FRAMESET>

With frames set up by the preceding code, an example link in the file “toc.html” might look like this:

<A HREF=”orderform.html” TARGET=”main”>Order Now!</A>

The TARGET attribute tells the browser that the file orderform.html should be loaded into the frame named main (the changing content frame) whenever a user clicks the hypertext Order Now! in the table of contents frame.

If all the links in toc.html target the frame named main, you can use the <BASE> tag in the head of the document to set a value for TARGET that applies to all links:

<HEAD>
<TITLE>Table of Contents</TITLE>
<BASE TARGET=”main”>
</HEAD>

With this <BASE> tag in place, every hyperlink targets the changing content window named main.

Netscape set aside some reserved frame names when it introduced the frame-related tags. These special target names include

  _blank Targets a new blank window that is not named.
  _self Targets the frame where the hyperlink is found.
  _parent Targets the parent <FRAMESET> of the frame where the hyperlink is found. This defaults to behaving like _self if no parent document exists.
  _top Targets the full window before any frames are introduced. This creates a good way to jump out of a nested sequence of framed documents.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.