spacer

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

home / web / dev / menus / intro

Introduction

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

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:

    jmp(0,0);  to
    jmp(formName,elementNum);
    

where formName is passed as "this.form" (converted to formNum by getFormNum function), and elementNum is the Nth element within that form. More details follow.

How the Menus Degrade

With browsers that support JavaScript 1.1 "new Option" command (currently Netscape 3.0+, and Explorer 4.0+) the subject menu controls the topic menu. Each time the subject menu is changed the code dynamically changes the topic menu to correspond to the topics under that subject. This allows two levels of site heirarchy to fit into one line of vertical screen real estate. You can also add a third sub-topic related menu using a similar technique.

For browsers that support JavaScript 1.0+ the popups are "live." They react to changes in state. When the user changes a menu option the code redirects them to the matching page. Clicking the "Go" button is not necessary. However, the "Go" submit button can also be used to jump to the current menu selection.

For browsers without JavaScript the menus work just like any other CGI-based select menu. Select an option and click on "Go." The code uses a redirect CGI script that jumps to the appropriate page. The key lines in the redirect script are:

    $target = "location: " . $env . $redirect . "\n\n"; print $target;

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

Note: For some reason this page bombs Gecko M7 Mac, use the next 2-D page technique instead.

Comments are welcome

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Crucial Triples Up With New Three-Channel DDR3 Kits · Meet the Finalists: Excellence in Technology Awards · Tealeaf Offers Insight to Mobile Customer Behavior

 



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

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