Chapter 7: Form Handling

Return to Chapter 7

 

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.

Changing Menus Dynamically

See it run: Changing Menus Dynamically

Script 7.3

This HTML file sets up a menu with the months of the year; the following JavaScript will populate a second menu with the number of days in the month after the user chooses a month.

Script 7.4

When the user picks a month from the first pop-up menu, this JavaScript populates a second pop-up menu with the correct number of days for the selected month.