Drawing the Layers

It happens too fast to see, but the folderTree code draws the entire tree, every folder and link, when the page is loaded. Once the entire tree is loaded, it's collapsed, except for the Europe and America folders. This procedure may sound simple, but it involves about two dozen different functions. We'll go over them, but before we do that, we should step back and see how the HTML is set up.

As you can see, this is a page in frames. Let's look at Example 21-2, the frameset page.

Example 21-2. The frameset page
 <html> <head> <title>FolderTree example</title> </head> <!-- (Please keep all copyright notices.) This frameset document includes the FolderTree script. Script found in: http://www.geocities.com/marcelino_martins/foldertree.html ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.