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


<TD>, <TH>

Type:

Container

Function:

Defines a cell in a table. <TH> creates a header cell whose contents will be rendered in boldface and with a centered horizontal alignment. <TD> creates a regular data cell whose contents are aligned flush left and in a normal font weight. Vertical alignment for both types of cells is MIDDLE by default.

Syntax:

<TD ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY|CHAR”
 VALIGN=”TOP|MIDDLE|BOTTOM|BASELINE”
 CHAR=”alignment_character” CHAROFF=”alignment_character_offset”
 NOWRAP ROWSPAN=”number_of_rows”
 COLSPAN=”number_of_columns”
 ABBR=”header_cell_abbreviation” AXIS=”list_of_category_names”
 HEADERS=”list_of_ID headers” SCOPE=”ROW|COL|ROWGROUP|COLGROUP”>

or

<TH ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY|CHAR”
 VALIGN=”TOP|MIDDLE|BOTTOM|BASELINE”
 CHAR=”alignment_character” CHAROFF=”alignment_character_offset”
 NOWRAP ROWSPAN=”number_of_rows”
 COLSPAN=”number_of_columns”
 ABBR=”cell_abbreviation” AXIS=”list_of_category_names”
 HEADERS=”list_of_ID headers” SCOPE=”ROW|COL|ROWGROUP|COLGROUP”>

Attributes:

Both the <TH> and <TD> tags can take the following attributes:

  ABBR—Specifies an abbreviation form of a cell’s contents.
  ALIGN—Controls the horizontal alignment within the cell. ALIGN can take on values of LEFT, RIGHT, CENTER, JUSTIFY, or CHAR.
  AXIS—Used to group cells into logical categories.
  CHAR—Specifies the alignment character for when ALIGN=”CHAR” is used.
  CHAROFF—Prescribes the offset distance from the alignment character.
  COLSPAN—Specifies the number of columns the cell should occupy.
  HEADERS—Provides a list of IDs of cells that provide header information for the current cell.
  NOWRAP—Suppresses text wrapping within the cell.
  ROWSPAN—Specifies the number of rows the cell should occupy.
  SCOPE—A simpler form of the AXIS attribute, SCOPE lets you group cells into rows, columns, row groups, or column groups, instead of arbitrarily named logical groups.
  VALIGN—Controls the vertical alignment of the cell. VALIGN can take on values of TOP, MIDDLE, BOTTOM, or BASELINE.

Example:

<TR VALIGN=”BOTTOM”>
<TH>Column 1 - center/bottom alignment</TH>
<TD VALIGN=”MIDDLE”>Column 2 - left/middle alignment</TD>
<TD ALIGN=”JUSTIFY”>Column 3 - justify/bottom alignment</TD>
<TD COLSPAN=2>Columns 4 and 5 - left/bottom alignment</TD>
</TR>

Form Tags

HTML forms are a Web surfer’s gateway to interactive content. Forms collect information from a user, and then a script or program on a Web server uses the information to compose a custom response to the form submission.

For all the form controls that are available to you as a document author, you need to know surprisingly few tags to produce them. These tags, together with some new tags introduced in the HTML 4.0 recommendation that improve form accessibility for the disabled, are covered in this section.

See “Forms,” p. 233.

<FORM>

Type:

Container

Function:

Contains the text and tags that compose an HTML form (see Figure 3.18).


FIGURE 3.18  HTML forms gather user input and send that information to a server for processing.

Syntax:

<FORM ACTION=”URL_of_processing_script” METHOD=”GET|POST”
  TARGET=”frame_name” ENCTYPE=”MIME_type_of_file_to_upload”
  ACCEPT-CHARSET=”acceptable_character_sets”
  ACCEPT=”acceptable_MIME_types”>
...
</FORM>

The <FORM> tag and its attributes are sometimes referred to as the form header.

Attributes:

The <FORM> tag takes the following attributes:

  ACCEPT—Specifies a list of acceptable content types (MIME types) that a server processing the form can handle correctly.
  ACCEPT-CHARSET—Set equal to a list of character sets that the form’s processing script can handle.
  ACTION—Set equal to the URL of the script or program that will process the form data. ACTION is a required attribute of the <FORM> tag.
  ENCTYPE—Used when you’re expecting a file upload as part of the form data submission and is set equal to the expected MIME type of the file.
  METHOD—Refers to the HTTP method used to send the form data to the server. The default METHOD is GET, which appends the data to the end of the processing script URL. If you set METHOD=”POST”, the form data will be sent to the server in a separate HTTP transaction.
  TARGET—Enables you to target the response from the processing script or program to a specific frame.

Example:

<FORM ACTION=”/shopping_cart.cfm” METHOD=”POST” TARGET=”response”>
...
</FORM>

Related Tags:

The following tags are valid only when used between the <FORM> and </FORM> tags: <INPUT>, <SELECT>, <OPTION>, <OPTGROUP>, <TEXTAREA>, <BUTTON>, <LABEL>, <FIELDSET>, and <LEGEND>. Each of these tags is described in this section.

<INPUT>

Type:

Standalone

Function:

Places one of the following form controls:

  Text, password, or hidden fields
  Check boxes
  Radio buttons
  File upload fields
  Image-based buttons
  Scripted buttons
  Submit and reset buttons

Syntax:

<!-- Text and password fields -->
<INPUT TYPE=”TEXT|PASSWORD” NAME=”field_name” VALUE=”default_value”
  SIZE=”field_size” MAXLENGTH=”maximum_input_length”
  DISABLED READONLY>

or

<!-- Hidden field -->
<INPUT TYPE=”HIDDEN” NAME=”field_name” VALUE=”field_value”>

or

<!-- Checkbox -->
<INPUT TYPE=”CHECKBOX” NAME=”field_name” VALUE=”field_value”
  CHECKED DISABLED>

or

<!-- Radio button -->
<INPUT TYPE=”RADIO” NAME=”field_name” VALUE=”field_value”
  CHECKED DISABLED>

or

<!-- File upload -->
<INPUT TYPE=”FILE” NAME=”field_name” VALUE=”default_value”
  ACCEPT=”acceptable_MIME_types” DISABLED>

or

<!-- Image-based button -->
<INPUT TYPE=”IMAGE” SRC=”URL_of_image_file” ALT=”text_description”
  ALIGN=”TOP|MIDDLE|BOTTOM|LEFT|RIGHT” USEMAP=”map_name” DISABLED>

or

<!-- Scripted button -->
<INPUT TYPE=”BUTTON” VALUE=”button_label” onclick=”script_name”
  DISABLED>

or

<!-- Submit/reset button -->
<INPUT TYPE=”SUBMIT|RESET” VALUE=”button_label” DISABLED>


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.