Forms and JS Events

Chapter 7: Forms (p.144-175)

HTML borrows the concept of a form (printed document that contains spaces for you to fill in information) to refer to different elements that allow you to collect information from visitors on your site. Whenever you want to collect information from visitors you need to use a <form> element.

Form Controls

Adding Text

Text input
Password input
Text area (multi-line)

Making Choices

Radio buttons
Multiple select box
File input box
Submit button
Image button
Grouping form elements

Chapter 14: Lists, Tables & Forms (pp.330-357)

Chapter 6: Events (pp.243-292)

Events are the browser’s way of indicating when something has happened

Different Event Types

Any of these events can be used to trigger a function in your JavaScript code

UI Events

Keyboard Events

Mouse Events


The load event is commonly used to trigger scripts that access the content of the page

Focus and Blur

The HTML elements you can interact with, such as links and form elements, can gain focus. These events fire when they gain or lose focus

W3C DOM Events

The DOM events specification is managed by the W3C (who also look after other specifications including HTML, CSS and XML)

HTML5 Events

The HTML5 specification deltails events that browsers are expected to support that are specifically used with HTML

BOM Events

Browser manufacturers also implement some events as part of their Browser Object Model. Typically, these events are not covered by W3C specifications