Buttons and Their Events

Throughout the book, you have seen several examples of buttons. Usually, the buttons are employed to fire functions and sometimes forget that buttons are a form element instead of something else. The following are all of the HTML button elements to be discussed in this section:

  • <input type=button>

  • <input type=reset>

  • <input type=submit>

  • <input type=radio>

  • <input type=checkbox>

  • <input type=image>

The Generic Button

By this point in the book, you have probably seen most, if not all, of the attributes associated with the generic input button form. However, the following attributes are the most important to keep in mind:

  • name

  • value

  • Mouse events

    onClick

    onMouseOver

    onMouseMove

    onMouseDown

    onMouseUp

    onMouseOut

    onFocus

    onBlur

Usually, onFocus ...

Get JavaScript Design 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.