Chapter 9: Handling Events

Return to Chapter 9

 

To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Form Event Handling: onfocus

See it run: Form Event Handling: onfocus

Script 9.17

This HTML creates a form, which won't allow entries in the e-mail field.

Script 9.18

This JavaScript prevents wayward field entries by using the onfocus handler in a form.