JavaScript
  Home arrow JavaScript arrow Page 2 - Bulleted Menu of Links
Moblin
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Bulleted Menu of Links
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-04-23

    Table of Contents:
  • Bulleted Menu of Links
  • Operation from the User’s Point of View
  • Algorithm
  • Code continued
  • Even More Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!

    Bulleted Menu of Links - Operation from the User’s Point of View


    (Page 2 of 5 )

    In this section, I explain how the user understands what he has to do, from his point of view. Assuming that a list item can be expanded (has a sub-list), when the user’s mouse pointer hovers over it, a tool tip should appear indicating that he can click the corresponding bullet to expand the list item (i.e. to see a sub-list). If the mouse pointer hovers over the parent list item, while the item is expanded, a tool tip should appear indicating that he can click the corresponding bullet to collapse the list into the parent list item (i.e. remove the sub-list). A list item that can be expanded, but has not yet expanded, has a disk-style bullet. When a list item is expanded, its bullet is a circle. A list item that cannot be expanded has the bullet of a square. The following figure illustrates this:


    • First Level Link 1

      • Second Level Link 11
      • Second Level Link 12

        • Third Level Link 121

        • Third Level Link 122

        • Third Level Link 123

      • Second Level Link 13

    • First Level Link 2

    • First Level Link 3

    Fig.3 List items in different states.

    Method

    In this section, I explain how it works from the technical perspective. All the lists and corresponding links form the content of one table cell. The secret is to use the DOM property called innerHTML. The following JavaScript statement sets the content of a table cell to the value of a string:


    document.getElementById("TDL").innerHTML = “Value of String”;

    Here, TDL is the ID of the table cell.

    Looking at the syntax of this statement, the value of the string can be text, or text with HTML tags. If the string contains HTML tags when the page is displayed, the result will be formatted (as seen by the user).

    Implementation

    In this section, we see how to write the code using JavaScript and HTML tags. Let us take fig.2 above as our example. Fig.2 can be considered a complete expansion of the list (and sub-lists) from fig.1; while fig.3 can be considered a partial expansion of the list in fig.1. Note the way I have named the different states of expansion in fig.2: First Level Link; Second Level Link and Third Level Link. Also note the numbers associated with these levels. Each group (sub-list) of links is at its state of expansion in an unordered list element. Before you write the code, you have to know the complete state of expansion (fig.2).

    When the web page is loaded, you see the three First Level links. These links are already on the web page at the server. However, when the web page is displayed, all the links (and associated lists), in whatever state of arrangement, are a string from a JavaScript function.

    When you click a bullet (or any part of the list item that is not the link), a JavaScript function is called. This function forms a new string by adding or subtracting a part of the string from the table cell. The function then sets the new string as the new content of the table cell, replacing anything that was there.

    More JavaScript Articles
    More By Chrysanthus Forcha


       · There are so many elements of bad practie put forward within this article. Using...
       · If you want the links of your web page to appear like the folder tree in Windows...
     

    JAVASCRIPT ARTICLES

    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway