HTML and CSS Reference
In-Depth Information
Figure 14-3
initial u.s. constitution page
ta b le of
contents box
When the page is initially loaded by a browser, you want it to run the makeTOC()
function to generate the code for the table of contents. You'll add the command to run
this function now; you'll also add the initial code for the function.
To begin creating the makeTOC() function:
1. Go to the toc.js file in your text editor.
2. Below the comment section, insert the following code, as shown in Figure 14-4:
/* Generate a table of contents based on h1 through h6
headings when the page is loaded by the browser */
window.onload = makeTOC;
/* Function to generate the TOC as a nested list */
function makeTOC() {
Search WWH ::

Custom Search