spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / web / dev / menus / intro2

Another Way

Senior Systems Engineer – Disk-Based Backup/Replication (PA)
Next Step Systems
US-PA-Philadelphia

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


Universal Related Popup Menus

Another way to approach the code is to first fill a two-dimensional array and create the new options on the fly. This technique makes it easier to add new menu items, and also extend this technique to another dimension. Here's a stripped down version for download.

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

Related Select Lists

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

The menus work identically to the previous page, and degrade gracefully. The array creation code has gone 2-D and now pregenerates the menu array outside the relate function.


Can You Relate?

The relate function, which changes the second menu based on the first menu's selection, has been stripped of the on the fly array creation and now uses the 2-D array we created above to change the second menu's options on the fly.


The guts of the relate function remain the same with two changes. The second menu's options array are now filled on the fly with the new Option command referring to the text and value properties of the a[j][i] element of our 2-D array. The aln2=a.length kludge was also replaced by calculating the length of the selectedIndex element of the 2-D array a (the number of options to be overwritten on the second menu).

This technique of pregenerating our options array can be extended into another dimension to create three related menus.

The full redirect.cgi script is also available in text form.

Comments are welcome


internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint



Created: Mar. 9, 1997
Revised: July 22, 1999

URL: http://webreference.com/dev/menus/intro2.html