Universal Related Popup Menus / Introduction | WebReference

Universal Related Popup Menus / Introduction

Introduction

Universal Related Popup Menus

The Universal Related Popup Menus (URPM) consist of two popup menus with matching submit buttons controlled by JavaScript and CGI. The left popup (menu1) is the "subject" menu and contains the main areas of the site (in this case WebReference.com). The right menu is the "topic" menu and contains the topics grouped under each subject. The topic menu defaults to topics under the first subject. In this case it lists the current experts on the site.

Choose a subject:
---> Choose a topic:

Related Select Lists

Choose a subject:
---> Choose a topic:

By adding the SIZE attribute to the SELECT tags, you can display multiple options at once. The SELECT menu displays as a scrolling list of options, rather than a popup menu. For the first SIZE options in each select list it takes just a single click to select and submit an option. Setting SIZE=1 displays the select lists as a popup menu.

The CGI redirect script is identical for both menus. In order to handle two sets of related menus the JavaScript was made more general using variables for the forms and elements instead of hard coding them.

Bug Fix: In the relate function, the last line makes the function act as a live popup. It does not relate as JavaScript 1.0 does not support the new option command. To make it work with any amount of forms within the page, I recently changed the line from: