HTML 4.0 defines the FIELDSET element, with an associated LEGEND , that can be used to visually group controls within a form. Note that the FIELDSET element works only in Netscape 6 and later and Internet Explorer 6 and later. HTML Element: <FIELDSET> ... </FIELDSET> Attributes: None. This element is used as a container to enclose controls and, optionally , a LEGEND element. It has no attributes beyond the universal ones for style sheets, language, and so forth. Listing 19.14 gives an example, with the result shown in Figure 19-26. Listing 19.14 Fieldset.html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Grouping Controls</TITLE> </HEAD> <BODY BGCOLOR="#FDF5E6"> <H2 ALIGN="CENTER">Grouping Controls</H2> <FORM ACTION="http://localhost:8088/SomeProgram"> <FIELDSET> <LEGEND>Group One</LEGEND> Field 1A: <INPUT TYPE="TEXT" NAME="field1A" VALUE="Field A"><BR> Field 1B: <INPUT TYPE="TEXT" NAME="field1B" VALUE="Field B"><BR> Field 1C: <INPUT TYPE="TEXT" NAME="field1C" VALUE="Field C"><BR> </FIELDSET> <FIELDSET> <LEGEND ALIGN="RIGHT">Group Two</LEGEND> Field 2A: <INPUT TYPE="TEXT" NAME="field2A" VALUE="Field A"><BR> Field 2B: <INPUT TYPE="TEXT" NAME="field2B" VALUE="Field B"><BR> Field 2C: <INPUT TYPE="TEXT" NAME="field2C" VALUE="Field C"><BR> </FIELDSET> </FORM> </BODY></HTML> Figure 19-26. The FIELDSET element lets you visually group related controls shown in Netscape 7.0.
HTML Element: <LEGEND> ... </LEGEND> Attributes: ALIGN This element places a label on the etched border that is drawn around the group of controls; it is legal only within an enclosing FIELDSET .
|