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


The BUTTON element delimits text or other content to be displayed as a push button. There are three possible types: TYPE=“button” (the default), “TYPE=“submit,” and TYPE=“reset,” which are functionally equivalent to INPUT elements of the same type. The difference is in the allowed content of the displayed button—with INPUT elements, this content is given by the VALUE attribute, while with BUTTON, this content is defined by the content of the button element, which can be any form of HTML markup. As a result, the rendered buttons can be far more complex. An example is shown in Figures 7.15 and 7.16, where the button contains paragraphs, blockquoted and enlarged-sized text, and images. BUTTON does take a VALUE attribute, which defines the value to associate with the button—and send to the server or JavaScript program—when the button is pressed.


Figure 7.16  Rendering, by Internet Explorer 4, of the document listed in Figure 7.15. Note how the disabled input elements are grayed out, while the FIELDSET (at the bottom of the page) is surrounded by a border and is labeled by the value of the LEGEND attribute.


Figure 7.17  Rendering, by Netscape Navigator 4, of the document listed in Figure 7.15—this browser does not support the new form-related elements and attributes. Note, however, how the FIELDSET content is acceptably displayed, because the markup is designed to work in the absence of support for FIELDSET and LEGEND.

There are some important restrictions to BUTTON content: BUTTON cannot contain the elements A, BUTTON, FIELDSET, FORM, IFRAME, INPUT, ISINDEX, LABEL, SELECT, or TEXTAREA. BUTTON elements can contain images, but these cannot be active or client-side imagemapped images. If you want a button image that is imagemapped, use the INPUT TYPE=“image” element.

BUTTON is not supported by Netscape Navigator 4 and is not compatible with older browsers that do not support BUTTON.

KEYGEN Element: Generate Encryption Key (Netscape Navigator Only)

Usage: <KEYGEN>
Can Contain: empty
Can Be Inside: Undefined, probably: ADDRESS, BLOCKQUOTE, BODY, CAPTION, CENTER, DD, DIV, DT, FIELDSET, FORM, Hn, LI, NOFRAMES, NOLAYER, NOSCRIPT, P, PRE, TD, TH,
character highlighting, A, APPLET, IFRAME, ILAYER, LAYER, LABEL, LEGEND, OBJECT
Attributes: NAME, CHALLENGE

KEYGEN generates encrypted public key certificates for submission, via a FORM, to a remote site—the remote site can use this key to authenticate the data sent to the server and the identity of the sender. The mandatory NAME attribute defines the name to use when sending the data to the server. The optional CHALLENGE attribute is assigned a challenge string, which is encrypted along with the user’s public key when the value for the KEYGEN is calculated; the decrypted CHALLENGE value can determine the identity of the document that sent the request. The default value for CHALLENGE is an empty string.

When present, KEYGEN produces a user-selectable list of key sizes. When the form is submitted, a key pair of the selected size is generated: The public key and challenge string are encoded, digitally signed with the private key, and encoded (base64) to produce the value part of the name/value pair. The private key is encrypted and is stored locally in a database of valid keys.

NAME=“string” (optional) Defines the name to be associated with the encrypted key. This is the name that is associated with the encrypted key when the name/value pair is sent to the sever.
CHALLENGE=“string” (optional) Specifies the challenge string, which is encrypted along with the user’s defined public key. The encrypted pair is sent as the value associated with the element’s NAME.

LABEL Element: Labeling Input Elements

Usage: <LABEL> ... </LABEL>
Can Contain: characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, EMBED, IFRAME, ILAYER, IMG, INPUT, KEYGEN, LAYER, MAP, OBJECT, SPACER, SCRIPT, SELECT, TEXTAREA, WBR
Can Be Inside: ADDRESS, BLOCKQUOTE, BODY, CAPTION, CENTER, DD, DIV, DT, FIELDSET, FORM, Hn, LI, MULTICOL, NOEMBED, NOFRAMES, NOLAYER, NOSCRIPT, P, PRE, TD, TH,
character highlighting, A, APPLET, IFRAME, ILAYER, LAYER, LEGEND, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers, onFocus, onBlur,
ACCESSKEY, FOR

The LABEL element defines a label for a specified input element. This relationship is defined using the FOR attribute of the LABEL, which takes, as its value, the ID value of the input mechanism with which the label is associated. For example, the markup

<TD> <LABEL FOR=“id23”> Set As Default: </LABEL> </TD>
<TD> <INPUT TYPE=“checkbox” ID=“id23” NAME=“fname” VALUE=“yes”> </TD>

associates the given label with the associated text input box—the ID value linking the two is highlighted in boldface. Note that this does not affect the rendering of the text or input mechanism and merely provides a way of logically linking these two components. Furthermore, the ACCESSKEY attribute of a LABEL lets an author tie a keyboard character to the input element, as discussed later in the section describing the ACCESSKEY attribute. For example, the markup:

<TD> <LABEL ACCESSKEY=“d” FOR=“id23”> Set As Default: </LABEL> </TD>
<TD> <INPUT TYPE=“checkbox” ID=“id23” NAME=“fname” VALUE=“yes”> </TD>

means that the author can type a special acceleration key sequence (ALT-d under Microsoft Windows) to access and “check” the associated checkbox. For more details, please see the ACCESSKEY Attribute section, later in this chapter.

Formally, a label can also be bound to an input element by placing the input element inside the LABEL, for example:

<LABEL> First Name: 
   <INPUT TYPE=“checkbox” NAME=“fname” VALUE=“yes”>
</LABEL>

However, this limits the way in which the label and associated input mechanism can be formatted (note that tabular layout of the two items is not possible). Given this limitation, plus the fact that this notation is not supported by Internet Explorer 4, you should avoid this approach.

FIELDSET Element: Grouping Input Elements

Usage: <FIELDSET> ... </FIELDSET>
Can Contain: Unspecified, probably: ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, DL, FIELDSET, FORM, Hn, HR, [ISINDEX], MENU, MULTICOL, NOEMBED, NOFRAMES, NOLAYER, NOSCRIPT, OL, P, PRE, TABLE, UL,
characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, EMBED, IFRAME, KEYGEN, LAYER, IMG, INPUT, LABEL, LAYER, LEGEND, MAP, OBJECT, SCRIPT, SELECT, SPACER, TEXTAREA, WBR
Can Be Inside: Unspecified, probably: BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, LI, MULTICOL, NOEMBED, NOFRAMES, NOLAYER, NOSCRIPT, TD, TH,
APPLET, IFRAME, ILAYER, LAYER, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers

FIELDSET groups together a related set of input elements and labels, so that they can be formatted and treated as a group. The content of a FIELDSET is simply a collection of input elements and labels, plus other HTML markup that structures the elements. Also allowed is a LEGEND element, which provides a label or title for the FIELDSET—this is the FIELDSET equivalent of a LABEL. For compatibility with older browsers, the LEGEND should appear just after the FIELDSET start tag.


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.