Button (Including Submit and Reset Buttons)

The button, submit, and reset form elements.

Properties

form

FF, IE 3

Read-only: Form containing the button

name

FF, IE 3

Name of a button. Note that name is not the text that shows up in the button on the web page (see the value property).

type

FF, IE 3

Read-only: Type of button: button, submit, or reset

value

FF, IE 3

String shown on the button

Handlers

onClick

FF, IE 3

Triggered when a visitor clicks on the button

onMouseDown

FF, IE 4

Triggered when the mouse is clicked on the button

onMouseUp

FF, IE 4

Triggered when the mouse is released after clicking

Example:

<input type = "button" value = "Click me" onClick = "this.value='Stop
clicking me!';">

When the user clicks this button, the words on the button change from Click ...

Get The Book of JavaScript, 2nd 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.