Sandeep's Nook: JavaScript Page

Collapsibe Menu with Memory

Collapsible Menu with Memory
+ Computing Links
+ More Links
Sub-Link 1
Sub-Link 2
-------------
+ Few More Links
Sub-Link 1
Sub-Link 2
-------------
Microsoft Corp.
Netscape Corp.
Macromedia Inc.
Symantec Corp.
------------------------
+ JavaScript Links
+ More Links
+ Few More Links
Sub-Link 1
Sub-Link 2
-------------
+ Even More Links
The JS Page
JavaScript Source
Doc JavaScript
------------------------
+ PHP Links
PHP Res. Index
PHP Code Excng.
------------------------

On the left of this page in yellow with black border is the Collapsible Menu with Memory. The menu has collapsible links. Clicking on those main links with the + symbol in front would open a hidden bunch of links. Such hidden links are mostly related to the main link which opens them. You can add any number of collapsible links or ordinary links to the menu. You can also add unlimited nested sub-links as shown in the example. If you click a main link it would close other open links related to any other main link while opening its own hidden links. This is applicable to the sub-links under each main link as well. You can completely change the appearance of the menu to best suit your needs. Additionally this script remembers if any of the main links or sub-links have been opened. So if visitors were to click open any of the link headers and go to another page, they would come back to the page to see the same links just as they had left them. Or if the same menu were to be placed on all pages of the site, the state of the menu would remain the same over all the pages.

Note: This script does not work with older browsers like Netscape v4.x but degrades very well.

Author: Sandeep Gangadharan
Home Page: http://www.sivamdesign.com/home/


The script is given below:

This goes in the HEAD of the html file:


This goes in the BODY of the html file: