New Form Attributes (HTML 4.0)

The HTML 4.0 Specification introduced a number of new attributes that make form elements more accessible and easier to use. Some can be used with Dynamic HTML to make form elements turn on and off, or become hidden or visible based on user input. Table 12.1 lists the new attributes along with the form elements to which they can be applied.

Table 12-1. New Form Attributes in HTML 4.0

Attribute

Description

Related Tag(s)

accept-charset

Specifies the list of character encodings (character sets) that must be accepted by the server processing the form. It is part of the W3C’s internationalization efforts requiring alternative character sets to represent non-Western writing systems.

<FORM>

accesskey

Assigns an access key (keyboard shortcut) to an element for quicker access.

<BUTTON>

<INPUT>

<LABEL>

<LEGEND>

<TEXTAREA>

disabled

Disables the control for user input.

<BUTTON>

<INPUT>

<OPTGROUP>

<OPTION>

<SELECT>

<TEXTAREA>

read-only

Prevents the user from changing the text in a field.

<INPUT type=text>

<INPUT  type=password>

<TEXTAREA>

tabindex

Specifies position in the tabbing order. Tabbing navigation allows the user to cycle through the active fields using the Tab key.

<BUTTON>

<INPUT>

<SELECT>

<TEXTAREA>

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.