Professional Documents
Culture Documents
Untitled
Untitled
Untitled
toc = document.getElementById("ToC");
//Add a header
tocHeader = document.createElement("h2");
tocHeader.innerText="Table of contents";
toc.appendChild(tocHeader);
// For each h3
for (i = 0; i < headers.length; i++){
// Create an id
name = "h"+i;
headers[i].id=name;
tocListItem.appendChild(tocEntry);
tocList.appendChild(tocListItem);
}
toc.appendChild(tocList);