spacer

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

home / experts / dhtml / column15

Logo

Cross-Browser Hierarchical Menus
menu creation and setup

Webreference

Contents

More of the same.

In longer script listings, cross-browser code is blue, Navigator-specific code is red, and Explorer code is green.

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

The all-important makeTop() function has no browser-specific code. A complete discussion of the statement logic can be found in our previous column.

Here, we have changed the status bar courtesy display to be slightly more informative. Since it is updated every time a top level menu item is created, the display changes more frequently, helping the user to understand what is happening in the background.

function makeTop() {

 while(eval("window.arMenu" + topCount)) {
  topArray = eval("arMenu" + topCount);
  topName = "elMenu" + topCount;

  topMenu = makeElement(topName);
  topMenu.setup = menuSetup;

  topItemCount = 0;
  for (i=0; i<topArray.length; i+=3) {
   topItemCount++;
  
   status = "Creating Hierarchical Menus: " + topCount + " / " + topItemCount;

   topItemName = "item" + topCount + "_" + topItemCount;
   topItem = makeElement(topItemName,topMenu);

   if (topItemCount>1)
    topItem.prevItem = (keep with next line)
      eval("item" + topCount + "_" +(topItemCount-1));

   topItem.setup = itemSetup;
   topItem.setup(i,topArray);

   if (topItem.hasMore) makeSecond();
  }
      
  topMenu.setup(false,topItem);
  topCount++
 }

 status = (topCount-1) + " Heirarchical Menu Trees Created"
 areCreated = true;
}

Don't worry, there are a couple of lines of browser-specific statements on our next page.


Produced by Peter Belesis and


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger

All Rights Reserved. Legal Notices.
Created: Feb. 27, 1998
Revised: Feb. 27, 1998

URL: http://www.webreference.com/dhtml/column15/menu2Load.html