Forms
One of the powerful features of JavaScript is its ability to manipulate HTML forms. HTML defines the following form elements:
- Button (
<INPUT TYPE=button>) A graphical push button;
onClickevents- Checkbox (
<INPUT TYPE=checkbox>) A toggle button without mutually exclusive behavior;
onClickevents- FileUpload (
<INPUT TYPE=file>) A file entry field and file browser;
onChangeevents- Hidden (
<INPUT TYPE=hidden>) A nonvisual data field; no event handlers
- Option (
<OPTION>) An item within a Select list; event handlers are on the Select object, not Option objects
- Password (
<INPUT TYPE=password>) An input field for sensitive data;
onChangeevents- Radio (
<INPUT TYPE=radio>) A toggle button with mutually exclusive “radio
"behavior;onClickevents- Reset (
<INPUT TYPE=reset>) A button that resets a form;
onClickevents- Select (
<SELECT[MULTIPLE]> . . . </SELECT>) A list or drop-down menu from which one or more Option items may be selected;
onChangeevents- Submit (
<INPUT TYPE=submit>) A button that submits a form;
onClickevents- Text (
<INPUT TYPE=text>) A single-line text entry field;
onChangeevents- TextArea (
<TEXTAREA> . . . </TEXTAREA>) A multiline text entry field;
onChangeevents
Figure 11.3 shows a web page that contains each type of form element.

Figure 11-3. Form elements
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access