Altering Menu Content

It's fairly common to see a Web page where two dropdown menus are next to each other, and choosing an item from the first menu changes the items in the second menu. In this section, we'll do this with an expanded Shelley example. Our first dropdown menu will contain the major sections of the site: News, Products, Research, Store, and About. Choosing one of these items will populate the second dropdown menu with specific pages and links. Choosing an item in the second menu will take the user to that page. This will look something like Figure 5-2.

Figure 5-2. Dual dropdown menus

Accomplishing this is actually easier than you ...

Get Advanced JavaScript™: Insights and Innovative Techniques 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.