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.

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


FORMs Not Supported?

It is now very rare, but there are still a few browsers in use that do not support forms. The little checkbox enclosed in square brackets near the top of Figures 2.26 and 2.27 is designed explicitly to handle this situation—note that this button does not do anything, as it lies inside its own FORM and does not have an associated submit button. However, this checkbox does test a browser’s support for forms. If the checkbox is absent, then the browser does not support forms, so the reader can see that there is a problem and select the text–only interface.

Lessons from Example 10

1.  The document developer can use the HTML FORM element to solicit user input. However, each form document must send the data it gathers to a server–side gateway program designed to analyze the form data. This gateway program is specified by the ACTION attribute of the FORM element. The program and form must be designed together.
2.  An HTML FORM can contain several input elements, namely INPUT, SELECT, and TEXTAREA. These elements can only appear inside a FORM.
3.  A FORM cannot be inside a heading element or inside another FORMFORMs cannot be nested. However, heading, list, character markup, PRE, and TABLE elements can be inside a FORM.

Exercises for Example 10

Constructing FORMs is a complicated compromise of structure and ease–of–use: You need to organize the input elements so that they are easy to use and understand, while keeping the form small enough that it does not get confusing. As an exercise, you can try creating HTML versions of some of the form–style interfaces of standard programs. You will find that TABLEs are one of the most useful tools for constructing well laid out input forms. Chapter 6 gives more details about how FORMs work. At this point, do not worry about the server–side processing of the data other than to give all the form input items appropriate NAMEs. Additional details about forms are found in Chapter 6 and 7, while form–based data processing is discussed in Chapters 10 and 11.

Example 11: Inline Data Viewers—EMBED and OBJECT Elements

In Example 5, we looked at hypertext links to data other than other HTML documents and discussed how these data could be processed by external helper applications. Sometimes, however, you do not want exotic data types to be displayed away from the document, but rather want them displayed within the text. For example, you might want an audio or movie player to appear right within the page of a text document or perhaps an Excel spreadsheet to be displayed next to a description of the data.

This is possible using the EMBED element (nonstandardized, but supported by Netscape and most other browser vendors) and the newer OBJECT element (partially supported in Internet Explorer 3, more fully but still incompletely supported in Navigator 4 and Internet Explorer 4). These are designed for embedding objects of arbitrary data types within an HTML document, much in the same way that images are embedded using the IMG element.

For example, using EMBED, an author can include one of these nonstandard data types using a tag such as which embeds the file movie.avi (a Microsoft AVI–format movie) in the document. How does the browser determine the data type of this file? The type is determined in the same manner described in Example 4: Either the HTTP server explicitly sends a MIME content–type header to indicate the type, or the browser guesses the type based on the filename extension, using its preconfigured database of filenames and MIME types.

<EMBED SRC=“/dir/video/movie1.avi” WIDTH=“200” HEIGHT=“150”>

This only works if the browser knows the filename extension—in fact, there are hundreds of extensions for which the browser has no default MIME type. Therefore, it is always best to serve data out using an HTTP server, since a properly configured Web server always sends the proper content–type MIME header. For example, the following EMBED element would insert a Corel CMX–format image into a document:

<EMBED SRC=“cmx/canary.cmx” WIDTH=“500” HEIGHT=“200”>

Current browsers do not know, by default, what this filename extension (.cmx) means and count on the server to provide the proper content–type information.

The EMBED element can take the three attributes SRC, WIDTH, and HEIGHT, which have the same meanings as with the IMG element. SRC gives the URL for accessing the data, while the HEIGHT and WIDTH give the size for the box that will display the data within the page. In addition, EMBED can take arbitrary user–defined attributes of the form PARAM_NAME=“value”, where both PARAM_NAME and value are arbitrary, and depend only on the particular data type being displayed. This turns out to be a bad way of doing things and, as a result, the EMBED tag will soon be dropped in favor of the much more flexible OBJECT element. OBJECT is discussed in detail in Chapter 7.

Figure 2.28 shows a typical HTML document that uses EMBED to include a special data type—in this case, a Corel CMX image. Figures 2.29 and 2.30 show the display of this document by the Netscape Navigator browser.

Displaying Embedded Data—Browser Plugins

Of course, just getting data to the browser is not sufficient, as you also need a way of displaying it. The problem is that the browser does not know how to do this without help. As you may recall from Example 5, this is the same problem we encountered when linking to arbitrary data types—in this case, the problem was solved by helper applications that processed the data in place of the browser. For embedded data types, we again need the help of additional software, but in this case this help must be plugged right into the browser. Such software modules are thus called browser plugins.

Figure 2.29 shows the Netscape Navigator rendering of the page shown in Figure 2.28, where the browser is not equipped with the special plugin capable of displaying Corel CMX image files. The browser, unable to display this data type, substitutes a default symbol indicating this failure. Note also the pop–up menu that informs the user that the plugged–in data is of an unknown type (the type would be listed as “image/x–cmx,” if the server understood this data type). Figure 2.30 shows the same document, but after the browser has been equipped with the Corel CMX plugin—the browser can now, via the plugin, display the image. In addition, the region displaying the CMX image supports special right–mouse button menu controls for processing and displaying the image. These controls are provided by the plugin module.

The bottom of Figure 2.29 and 2.30 show an additional plugin, in this case one that plays audio files. This plugin is a control panel: The slider on the bottom is a volume control, while the other buttons stop, pause, and play the audio file. More sophisticated controls are, of course, found in other plugins.

Finally, Figure 2.31 shows what users see when using a browser that does not support plugins. In this case they see nothing, which can lead to very confusing and/or misleading documents. The EMBED element does not allow for an alternative to the embedded data, which is a major weaknesses of the EMBED approach.


Figure 2.28 Example HTML document embed.html, which uses the EMBED element to include arbitrary data types within the HTML document. The rendering of this document by the Netscape Navigator browser is shown in Figures 2.29 and 2.30.

<HTML><HEAD>
<TITLE> Example of the EMBED Element</TITLE></HEAD>
<BODY>
<H1>Example of the EMBED Element</H1>
<BLOCKQUOTE>
<P>These simple examples illustrate the  <B>EMBED</B> element,  as currently
implemented on the Netscape Navigator and some other browsers. <BR>
<EMBED SRC=“canary.cmx” WIDTH=200 HEIGHT=150><BR>
<P> Here is another <B>EMBED</B>, this time for an audio file. The associated
 plugin is an audio control panel—
<EMBED SRC=“sound.au” WIDTH=“145” HEIGHT=“60” HSPACE=“10” VSPACE=“5”>
 the panel is treated like an image. 
<P> You can also left and right–align the plugin, in the same way as images.
<EMBED SRC=“sound.au” WIDTH=“145” HEIGHT=“60” HSPACE=“10” VSPACE=“5” ALIGN=“LEFT”>
<EMBED SRC=“sound.au” WIDTH=“145” HEIGHT=“60” HSPACE=“10” VSPACE=“5” ALIGN=“RIGHT”>
Here are two examples: note how the text wraps around the panels, just as it 
wraps around regular image files. 
</BLOCKQUOTE>
</BODY></HTML>


Figure 2.29  Rendering of the document in Figure 2.28 by a Netscape Navigator browser that is not equipped with the appropriate plugin. The browser is consequently unable to display the embedded data.


Figure 2.30  Rendering of the document in Figure 2.28 by a Netscape Navigator browser equipped with the appropriate plugin. The browser can now display the embedded data, with the plugin also providing a user interface that lets the user manipulate the data.


Figure 2.31  Rendering of the document in Figure 2.28 by the NetManage WebSurfer 5.02 browser. This browser does not support Netscape plugins.


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.