Click Here!
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


The <IFRAME> tag has three required attributes: WIDTH, HEIGHT, and SRC.WIDTH and HEIGHT specify the width and height of the floating frame in pixels or as a percentage of the browser screen’s width and height. SRC tells the browser the URL of the document to load into the floating frame. Thus, your basic floating frame HTML looks like this:

<IFRAME WIDTH=250 HEIGHT=112 SRC=”<http://www.server.com/floating.html”>>
Text or image-based alternative to the floating frame
</IFRAME>

In addition to the three required attributes, the <IFRAME> tag takes several other attributes that give you good control over the floating frame’s appearance. These include

  FRAMEBORDER—By setting FRAMEBORDER=1, you place a beveled border around the floating frame. This gives the frame the appearance of being slightly recessed on the page. If you prefer a more seamless look (as in Figure 7.9), you can use the FRAMEBORDER attribute in the <IFRAME> tag. Setting FRAMEBORDER=0 eliminates the beveled border.


FIGURE 7.9  Floating frames enable you to place a new document right in the middle of the main document. The quote you see on this page is actually randomly selected from within a floating frame.

  SCROLLING—A browser that can render floating frames puts a scrollbar on the floating frame if the document it contains exceeds the dimensions of the frame. You can suppress the scrollbars by specifying SCROLLING=NO in the <IFRAME> tag. If you always want scrollbars present, you can set SCROLLING equal to YES.
  LONGDESC—Speech- and Braille-based browsers can use the URL specified by the LONGDESC attribute to get more information about what’s being presented in the floating frame.
  ALIGN—You can float the floating frame in the left or right margins by specifying ALIGN=LEFT or ALIGN=RIGHT. Any text following the floated frame wraps around it to the right or left, respectively. You can use the <BR> tag with the appropriate CLEAR attribute to break to the first line clear of floated frames.
  NAME—Naming a floating frame enables you to target it with the TARGET attribute in an <A> tag. Thus, you can set up links to documents and have them appear in the floating frame.


NOTE:  Early incarnations of the <IFRAME> tag took the HSPACE and VSPACE attributes. If your floating frame needs some clear space around it, the HSPACE and VSPACE attributes of the <IFRAME> tag work the same as they do for the <IMG> tag: HSPACE adds clear space to the left and right of the floating frame, and VSPACE adds clear space above and below. HSPACE and VSPACE values are in pixels.

The HTML 4.0 recommendation does not include these attributes for the <IFRAME> tag, so if you use them, be aware that you are using nonstandard HTML.


Using Hidden Frames

A technique that has emerged recently involves the use of hidden frames. Hidden frames are frames that have no size and, therefore, are not visible to a user. You might set up a hidden frame with code such as

<FRAMESET ROWS=”30%,70%,*”>
   <FRAME SRC=”frame1.html” NAME=”frame1">
   <FRAME SRC=”frame2.html” NAME=”frame2">
   <FRAME SRC=”frame3.html” NAME=”hidden_frame”>
</FRAMESET>

This creates a frameset with three rows. The first row has a height equal to 30% of the browser window height, the second row a height equal to 70% of the browser screen, and the third row a height of whatever is left over. However, because the entire browser window height is consumed by the first two rows, the third row has a height of zero and is hidden from view.

You may be asking: if a frame can’t be seen, what good is it? The answer is that it is good for behind-the-scenes kinds of activity such as JavaScripting. When Netscape released its NetHelp online help package with Navigator 4, it used JavaScript tucked away in hidden frames to control aspects of the NetHelp interface such as the processing stack, activity tracking, and error handling. JavaScript code for all these functions is read into a hidden frame named SystemFrame, and a NetHelp application is able to make calls to this frame to invoke script code when needed.

Another use of hidden frames is in applications developed in ColdFusion or Active Server Pages. With either technology, an HTML document is dynamically generated and returned to the browser. Occasionally, it is appropriate to build a hidden frame into the HTML document that contains state information that cannot be stored as a cookie or on the server.

See “Active Server Pages and VBScript,” p. 835.

See “Using ColdFusion,” p. 879.

Developing Framed Layouts in an HTML Editor

When the frame tags first came on the scene, many content developers were challenged by their complexity. Things were made worse by having to do all the code by hand and without the luxury of any kind of WYSIWYG preview capability. Fortunately, most top-notch content development programs now include some support for authoring framed documents. This chapter closes with a look at three such programs.

Microsoft FrontPage 98

The FrontPage 98 Editor has its own Frames menu from which you can initiate just about any frames-related task. To get started with a framed layout, choose Frames, New Frames Page to call up the dialog box you see in Figure 7.10. Here you find a list of 10 preconfigured framed layouts that FrontPage can set up for you automatically.


NOTE:  You can access this same list of available framed layouts by choosing File, New, and then clicking the Frames tab.

As you highlight the different selections, you see a preview of how each breaks up the browser screen. After you find the one you want, click OK and the framed layout is loaded into the Editor. Figure 7.11 shows the Header, Footer and Contents layout.


FIGURE 7.10  The FrontPage Editor can set up <FRAMESET> tags for 10 framed layouts.


FIGURE 7.11  A selected frame layout gets loaded into the FrontPage Editor, where you can work on each frame individually.


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.