Register for EarthWeb's Million Dollar Sweepstakes!
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.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Nonexistent TARGET Name

If an anchor or FORM references an undefined TARGET name, then the browser will create a frame with this name and place the document in this newly created frame. However, there is no way to create a new frame within a framed document, so the browser creates a new browser window and gives this entire window the new name. For example, the anchor surrounding the word “Deer” references the target name “blobby,” which was not defined in fig7-1.html. Thus, when this link is accessed there is no frame defined for this document, so it is retrieved and placed in a new browser window, as shown in Figure 7.7.

Predefined TARGET Names

The frame specifications define four special target names. These values, all of which begin with the underscore (_) character, were defined in Table 6.10. To reiterate, these values are:


Value Meaning
_blank Load the referenced data into a new, unnamed window.
_self Load the referenced data in place of the current document.
_parent Load the referenced data into the window containing (or, that contained) the parent of the current document (the document from which the current document was accessed). If there is no parent document, default to TARGET=“_self.”
_top Load the referenced data into the window containing (or, that contained) the “top” document (the document obtained by iteratively searching through successive parent documents until arriving at the initial, starting document). If there is no top document, default to TARGET=“_self.”


NOTE:  All other names beginning with an underscore (_) are ignored by the browser.

Appropriate Use of Frames

Frame documents can be quite useful, as they allow for easy separation of the various components of a page. However, this utility comes at a price, and an author must be aware of the problems associated with frames before diving wholeheartedly into frame-based design.

One problem relates to browser bookmark or “favorites” lists. The problem is that, in general, frame documents cannot be bookmarked. This is because the URL of a frame document simply gives the starting point for the collection of framed pages—if the user selects links that change the content of the different frames, the URL referencing the collection of frames does not change. Thus, if users bookmark one of these later “views,” accessing the bookmark will return them to the very first framed document, which may be very different from the intended page.


Figure 7.7  Document generated by selecting the link “Deer” in Figure 7.4. The target name is not defined, so a new window with this name is created.

The only way to avoid this problem is to ensure that any pages likely to be bookmarked are either nonframed or are documents that themselves contain all the frameset and frame elements that create the view. This can be done, but only using very complicated Web site designs. It is thus important to decide early on which pages need to be bookmarked, so that you can properly plan ahead and budget your resources.

A second problem is accessibility. Many visually impaired users employ screen readers to “dictate” the page content and navigate between pages. Unfortunately, such software does not work well with frame documents, often because it is unclear which frame should be read first or even which frames are important. Thus, if accessibility is important, you should avoid frames.

By this point, you must be wondering when frames should be used! The answer is that framed documents are most useful when designing search interfaces (the different panes can represent different components of the search tool or returned results) or when building interfaces to complex software applications. In these cases, bookmarking is usually unimportant, while the use of frames can make it easier to design the application from a collection of “framed” parts.

There are several efforts underway to improve on the FRAME approach, by using style sheets to specify the structure and orientation of page content or by adding into the URL syntax structural information associated with a set of frames. However, none of these approaches is close to being implemented.

The next sections provide detailed specifications for the frame-related elements.

FRAMESET Element: Declare a FRAME Document

Usage: <FRAMESET> ... </FRAMESET>
Can Contain: FRAME, FRAMESET, NOFRAMES
Can Be Inside: HTML
Attributes: CLASS, ID, STYLE, TITLE, onLoad, onUnload, onBlur, onFocus,
BORDER, BORDERCOLOR, COLS, FRAMEBORDER, FRAMESPACING, ROWS

FRAMESET divides a region of a framed document into frames. An HTML document containing a FRAMESET cannot contain BODY content, other than within a NOFRAMES. If you include regular BODY element tags prior to the first FRAMESET, Netscape Navigator browsers will entirely ignore the FRAME and FRAMESET elements and will display the NOFRAMES content (if any).

The layout and size of the frames defined by a FRAMESET are specified by the COLS or ROWS attribute. COLS indicates that the frames are laid out in columns, with the comma-separated values assigned to COLS specifying the number and sizes of the columns. ROWS indicates that the frames are laid out in rows, with the comma-separated value assigned to ROWS specifying the number and sizes of the rows. A FRAMESET must have one of ROWS or COLS, but not both.

The number of comma-separated values assigned to ROWS or COLS specifies the number of frames contained within the FRAMESET, while the values determine the frame sizes. The values can take the three possible forms described in Table 7.1.

The TITLE attribute is nonfunctional in Netscape Navigator 4. However, Internet Explorer 4 uses the TITLE text as a pop-up text description of a frameset, should the mouse hover above the border between the frames.

The CLASS, ID, and STYLE attributes can assign style sheet formatting rules to the FRAMESET (e.g., borders, sizes, etc.). Note that these rules only affect the layout and formatting of the frames and not the formatting of the document referenced by a FRAME. Care should be taken with such rules, due to possible interaction between properties specified by a FRAMESET and those specified by a style sheet. Also, an author should note that there are several bugs in Netscape Navigator 4 implementation of style sheets with frames, so that it is best to avoid using style sheets with FRAME and FRAMESET.

The four listed event handlers are implemented by both Internet Explorer 4 and Netscape Navigator 3 and 4, as discussed in the scripting section later in this section. Only onLoad and onUnload are defined in the HTML 4 specifications. Thus, the event-handling attributes onBlur and onFocus are proprietary in this context: Although they will work under current browsers, you should avoid using them here. The meanings of the commonly implemented event handlers are given in Table 7.5.


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.