Name

Input — an input element in an HTML form

Availability

Client-side JavaScript 1.0; enhanced in JavaScript 1.1

Inherits From

HTMLElement

Synopsis

                     form.elements[i]
form.name

Properties

Input inherits properties from HTMLElement and defines or overrides the following:

checked

Whether a Checkbox or Radio element is checked.

defaultChecked

A Checkbox or Radio element’s default status.

defaultValue

The default text displayed in an element.

form

The Form containing the element.

name

The name of a form element.

type

The type of a form element. JavaScript 1.1.

value

The value displayed or submitted by a form element. Navigator 2; buggy in Internet Explorer 3.

Methods

Input inherits methods from HTMLElement and defines or overrides the following:

blur()

Remove keyboard focus from a form element.

click()

Simulate a mouseclick on a form element.

focus()

Give keyboard focus to a form element.

select()

Select the text in a form element.

Event Handlers

Input inherits event handlers from HTMLElement and defines or overrides the following:

onblur

The handler invoked when a form element loses focus.

onchange

The handler invoked when a form element’s value changes.

onclick

The handler invoked when a form element is clicked. JavaScript 1.0; enhanced in JavaScript 1.1.

onfocus

The handler invoked when a form element gains focus.

Get Webmaster in a Nutshell, Second Edition 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.