INPUT

Description

The Input element specifies a form input control, which represents a field whose contents may be edited or activated by the user.

Syntax

<INPUT
ACCESSKEY=key
ALIGN=LEFT | CENTER | RIGHT
ALT=alternative text
CLASS=Style Sheet class name
DISABLED
DYNSRC=url
ID=value
LANG=language
LANGUAGE=JAVASCRIPT | JSCRIPT | VBSCRIPT | VBS
LOWSRC=url
MAXLENGTH=n
NAME=name
READONLY
SIZE=n
SRC=url
STYLE=styling
TABINDEX=n
TITLE=text content
TYPE=BUTTON | CHECKBOX | FILE | HIDDEN | IMAGE | PASSWORD | RADIO | RESET | SUBMIT | TEXT
VALUE=value
event = script
>

Parameter

Description

ACCESSKEY

Accelerator for the element. Pressing ALT-key selects this element in the user's browser.

ALIGN

Displays the element left flush, right flush, or centered relative to the display or table.

ALT

Optional text as an alternative to the graphic for rendering in non-graphical environments. Alternate text should be provided whenever the graphic is not rendered. Alternate text is mandatory for Level 0 documents.

CLASS

Class of the tag being defined. This is used to associate a subclassed style sheet with the tag.

DISABLE

Used to disable an element from receiving any user input, or focus and causes the element to appear "grayed out."It can still display values, text etc., but the user will not be able to make any changes to those values.

DYNSRC

Specifies the address of a video clip or VRML world to be displayed in the window. Stands for Dynamic Source.

ID

SGML identifier used as the target for hypertext links or for naming particular elements in associated style sheets. Valid ID values must begin with a letter. The underscore character, "_", may be used in the ID name. The ID should be unique throughout the scope of the document. If more than one object with the same identifier exists in a document, a collection of those named items is created that can only be referenced by ordinal position.

LANG

Specifies which language to use in ISO standard language abbreviation form.

LANGUAGE

Specifies the language the current script is written in and invokes the proper scripting engine. The default value is JAVASCRIPT.
* JAVASCRIPT, JSCRIPT The script is written in JScript.
* VBS, VBSCRIPT The script is written in VBScript.

LOWSRC

Specifies a lower resolution image to be displayed initially while the document is loading, which is later replaced by the higher quality version SRC.

MAXLENGTH

Indicates the maximum number of characters that can be entered into a text field. This can be greater than specified by the SIZE attribute, in which case the field will scroll appropriately. The default number of characters is unlimited.

NAME

Window or frame at which to target the contents. If no frame or window exists that matches the specified target, a new window is opened for the specified link. If no target is specified, the default is "_self" for a link within the same site or "_top" if the site is external. Special target values are:
_blank Specifies to load the link into a new unnamed window.
_parent Specifies to load the link into the immediate parent of the document the link is in.
_self Specifies to load the link into the same window the link was clicked in.
_top Specifies to load the link into the full body of the current window.

READONLY

Causes the element's property to be read only. The INPUT element can still receive the focus but the contents of the control can not be changed. This attribute applies to the PASSWORD and TEXT input types.

SIZE

Specifies the size or precision of a field according to its type.

SRC

Specifies a URL for the associated file.

STYLE

Inline style sheet for the tag.

TABINDEX

Sets the tabbing order for the user to navigate around the main <FORM>. This attribute applies to the BUTTON, CHECKBOX, FILE, PASSWORD, RADIO, RESET, SUBMIT, and TEXT input types.

TITLE

The TITLE attribute is for advisory information (unless used with a mailto: attribute). The Title attribute should provide the title of the document whose address is given by the HREF attribute. The contents of the title attribute will be displayed in a tooltip during the mouse moves on the link. Internet Explorer 4.0 (and above) is the only browser to implement this.

TYPE

Specifies the type of data the field accepts. Defaults to free text. Several types of fields can be defined with the type attribute:

BUTTON

Button Type

A button on the HTML form that is given functionality when used in conjunction with Visual Basic Script, or JavaScript. The NAME attribute is used to give the button a unique name, which can be used to set its function in the script. The VALUE attribute specifies the text that is displayed on the button in the document.

CHECKBOX

Checkbox Type

Used for simple Boolean attributes (weather a field is chosen or not), or for attributes that can take multiple values at the same time. It is represented by a number of check box fields, each of which has the same name. Each selected check box generates a separate name/value pair in the submitted data, even if this results in duplicate names. The default value for check boxes is "on". It requires the NAME and VALUE attributes, optional attributes being CHECKED.

FILE

File Type

A file upload element that allows the user to supply a file as the input.

HIDDEN

Hidden Field Type

With this input type, no field is presented to the user, but the content of the field is sent with the submitted form. This value may be used to transmit state information about client/server interaction.

IMAGE

Image Type

An image field that you can click, causing the form to be immediately submitted. The coordinates of the selected point are measured in pixel units from the upper-left corner of the image, and are returned (along with the other contents of the form) in two name/value pairs. The x-coordinate is submitted under the name of the field with ".x" appended, and the y-coordinate is submitted under the name of the field with ".y" appended. Any VALUE= attribute is ignored. The image itself is specified by the src= attribute, exactly as for the IMG element.

PASSWORD

Password Type

It is the same as the TEXT attribute, except that text is not displayed as it is entered.

RADIO

Radio Type

Used for attributes that accept a single value from a set of alternatives. Each radio-button field in the group should be given the same name. Only the selected radio button in the group generates a name/value pair in the submitted data. Radio buttons require an explicit VALUE and NAME attribute. CHECKED is an optional attribute and can be used to specify which options are selected for initial form display.

RESET

Reset Type

When this button is pressed, the specified initial values in the form's fields will be reset. The label to be displayed on the button may be specified just as for the SUBMIT button.

SUBMIT

Submit Type

If a SUBMIT button is pressed, it is to submit a form. The default label is application-specific and if the button has a NAME attribute specified, the button would contribute a name/value pair to the submitted data.

TEXT

Text Type

Used for a single-line text-entry field. Use in conjunction with the SIZE= and MAXLENGTH= attributes to set the maximum amount of text that can be entered.

VALUE

For textual/numerical controls, specifies the default value of the control. For Boolean controls, specifies the value to be returned when the control is turned on. This attribute applies to the BUTTON, CHECKBOX, HIDDEN, PASSWORD, RADIO, RESET, SUBMIT, and TEXT input types.

event

Can be one or more of these events:
onafterupdate ;
onbeforeupdate ;
onblur ;
onchange ;
onclick ;
ondblclick ;
ondragstart ;
onfocus ;
onhelp ;
onkeydown ;
onkeypress ;
onkeyup ;
onmousedown ;
onmousemove ;
onmouseout ;
onmouseover ;
onmouseup ;
onselect ;
onselectstart

Example

<FORM ACTION="_URL_" METHOD="GET|POST" ENCTYPE="MIME type">
<p> Name:
<input type="text" name="textfield">
<br>
Password:
<input type="password" name="password">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</p>
</FORM>

The code is rendered as:

Name:
Password:

Remarks

Objects can be submitted in forms. The NAME is the identifier of the object tag (i.e., <OBJECT NAME=slider CLASSID=...>), and the VALUE is obtained by getting the value of the default property of the control. If any of the following conditions occur, then the object will not become part of the submit string:

Related Topics

BUTTON, IMG, TEXTAREA, OBJECT