Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

The menu revealed

January 19, 1999

The contents of this particular menu is actually made up of 5 layers -- the headline plus each article link (4). The main reason each article link resides within its own layer is to allow for the highlighting effect, wherein the item being hovered over changes to a beige background. All of these layers are actually wrapped inside a large outer layer which represents the entire menu as one entity. The outer layer, which we'll see more closely later, is mainly used to test whether the mouse is on or off the menu with respect to the rules governing menu disappearance.

When these layers are created in the HTML, though, they are not positioned in vertical alignment because we cannot know the height of each layer at the time of creation (which may vary depending on font size, browser platform, and so forth). Since the layers are initially created as invisible this poses no aesthetic problem. Rather, once popups.html loads into the menu window, the setup() function will be called for each menu, vertically aligning its constituent layers. This function sets up the menu whose name is passed via the topic parameter; e.g. setup("annuities") will setup the annuities topic menu. To clarify, each menu is setup only once, quite like setting up a chessboard in preparation for a game.

First, setup() has to determine how many layers the menu contains. As stated, the menu pictured above contains 5 layers. This brings us to why we needed separate code for each browser -- Netscape knows how many "child layers" a layer contains. In other words, it knows that the outer layer for the pictured menu (named "state", based on the topic name) contains 5 child layers. Internet Explorer does not have such insight -- rather, it knows how many children a layer may contain but these children are not limited to other layers. Thus, the separate code for Explorer first counts the number of children which are actually layers and then moves forward from there in a similar fashion as the Netscape code.

In brief, the heart of the setup() code is the for loop (the one in the Netscape section and the second for loop in the Microsoft section). This loop simply places the top of each layer subsequent to the first at the position of the previous layer's bottom. The result is that all the layers line up vertically. By increasing the gap value we could add space between each layer rather than align them flush, were that desired.

Once this setup() function has been called for each topic menu all of the menus are properly aligned. But the menus themselves are still invisible -- they're simply ready to be called "up" at any time now.

Initiating setup for each menu.
function initSetup()
{ setupComplete=false;
  setup("annuities");
  setup("auto");
  setup("business");
  setup("health");
  setup("home");
  setup("life");
  setup("personal");
  setup("state");
  setup("ratings");
  setup("features");
  setup("toolbox");
  setup("help");
  setup("sponsor");
  setupComplete=true;
  
}

As implied, the setup() function is executed for a particular menu whose name reflects its topic. The initSetup() function explicitly calls setup() for each of this client's topics. It may seem odd to write out each function call as has been done here but this was found to be necessary to properly signal the main browser window when setup has been complete. Because we don't want to pop-up a menu before setup is complete the boolean variable setupComplete is created. The "mission control" script, which resides in the main browser window (embedded into the client's original page) can check this setupComplete variable to verify whether the menus are ready to pop-up.

Setting up the menu's layers
DHTML Pop-Up Menus: A Parable of Triumph and Loss (Based on a True Story)
Coloring the stylesheets


Up to => Home / Authoring / DHTML / Menus




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers