. Please go there to find the latest scripts, information, etc. These pages will remain here for a while for historical purposes in case anyone needs a production copy of old code.
This code is an extension of the great work done by Stuart Langridge's aqlists. I've re-written his code and added a lot of my own features to make what I feel is the best option for building expanding and collapsing tree structures using DHTML.
What's unique about this approach (and Stuart's) is that this code requires almost no effort for the person designing the site. The entire tree structure is built from a normal <UL> HTML structure. The DHTML loads, finds the structure, and builds a tree out of it, all automatically!
The look and functionality is controlled entirely through CSS, so only newer browsers will be able to see the tree (IE5+, NN6+, Opera, etc). However, older browsers like Netscape4 will still see your entire data structure as a plain Unordered List, so it degrades nicely!
See the documentation for details on exactly how to use this in your page, and view the source of this page as an example.
View the source of this document to see that the tree below exists in the HTML document as a plain unordered list. The only thing done in the code is to set the CLASS of the UL. Also, the class of a couple of sub-listings were set to "liOpen" to show how the tree can be initialized to a state when loaded. That's it! It couldn't be simpler.
This is the directory listing for an installation of CalendarScript:
Expand and find login.html
For future consideration: I want to add cookie support, so the state of the tree remains the same for each unique tree (with a given ID). This would allow you to leave a page with a tree and come back later and have it expanded to the same place as before. If I get time...