Home arrow HTML arrow Page 3 - Building a Bulleted Menu Of Links: Display Method
HTML

Building a Bulleted Menu Of Links: Display Method


Many web pages display their links in the form of a bulleted menu. You can make such menus a bit more interesting by adding functionality to expand and contract the menu, if it makes sense to divide the menu into levels. This two-part article will show you how to do it.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 3
February 23, 2009
TABLE OF CONTENTS:
  1. · Building a Bulleted Menu Of Links: Display Method
  2. · Operation from the User’s Point of View
  3. · Implementation
  4. · The UL and LI elements

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building a Bulleted Menu Of Links: Display Method - Implementation
(Page 3 of 4 )

For simplicity I will use the arrangement in Fig. 2 to explain how you can do the coding.

The IDs of the UL and LI elements have been given in a way that is useful in the code.

The IDs corresponding to the structure in Fig. 2 can be presented as follows to reflect the structure:


LI_1

UL_11

    LI_11

    UL_111

    LI_12

    UL_121

    LI_13

    UL_131

LI_2

UL_21

    LI_21

    UL_211

    LI_22

    UL_221

    LI_23

    UL_231

LI_3

UL_31

    LI_31

    UL_311

    LI_32

    UL_321

    LI_33

    UL_331


Fig.5 IDs

The IDs for the LI elements begin with LI (for List), then an underscore, and then a number. The IDs for the UL elements begin with UL (for Unordered List), then an underscore, and then a number.

The IDs for the first level link elements are LI_1, LI_2 and LI_3. The IDs for the UL elements associated with (below LI) these LI elements are respectively, UL_11, UL_21 and UL_31. Note the extra 1 added to the corresponding numbers of the UL elements. The IDs have been given, taking into consideration the levels.

The IDs for the LI elements inside the UL_11 element are LI_11, LI_12 and LI_13. The numbers for the UL_11 element and its first list element (LI_11) are the same. The IDs for the LI elements inside the UL_21 element are LI_21, LI_22 and LI_23. The numbers for the UL_21 element and its first list element (LI_21) are the same.

The IDs for the LI elements inside the UL_31 element are, LI_31, LI_32 and LI_33. The numbers for the UL_31 element and its first list element (LI_31) are the same. The ID for the UL element associated with (below) the LI_11 list element is UL_111; that for LI_12 is UL_121; that for LI_21 is UL_211; that for LI_23 is UL_231, etc. Note the extra 1 added.

The LI elements inside the UL elements for UL_111, UL_121, etc do not have IDs. In our structure (fig. 2), they cannot cause a sub-list to expand or collapse.

The very first parent UL element that contains all the elements does not need to have an ID. No ID has been indicated for it in the ID structure.

Each LI element has an onclick event. We shall talk about the events shortly.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials