HTML and CSS Reference
In-Depth Information
To set the display status of that heading, you then can call the isHidden() function as
follows:
if (isHidden(TOCentry)) displayStatus = “none”
else displayStatus = “”;
Finally, you can apply the value of the displayStatus variable to the heading and subse-
quent element nodes using the command
n.style.display = displayStatus;
You'll add these commands to the expandCollapseDoc() function now.
To complete the expandCollapseDoc() function:
1. Scroll up to the expandCollapseDoc() function and then insert the following com-
mands within the first if condition:
var TOCentry = document.getElementById(“TOC” + n.id);
if (isHidden(TOCentry)) displayStatus = “none”
else displayStatus = “”;
2. Add the following command to the second if condition, as shown in Figure 14-55:
n.style.display = displayStatus;
Figure 14-55
completing the expandcollapsedoc() function
3. Scroll up to the expandCollapse() function, and then add the following statements
to the end of the function (see Figure 14-56):
/* Expand and collapse the source document to match
the table of contents */
expandCollapseDoc();
Figure 14-56
completing the expandcollapse() function
 
Search WWH ::




Custom Search