[thelist] TOC using DOM?

James Denholm-Price j.denholmprice at gmail.com
Thu Jun 24 05:21:56 CDT 2004


I'll have a quick bash at #1:

On Thu, 24 Jun 2004 10:03:29 -0000, david.landy at somerfield.co.uk
<david.landy at somerfield.co.uk> wrote:
> So far so good, except for 2 small things:
> 1. My TOC appears at the end of the doc, not the top

Your new nodes are being APPENDED to the document:
document.body.appendChild(newel);
so they appear at the bottom!

You need to add them somewhere else in the DOM, e.g. to the top using
document.body.firstChild.insertBefore
or (perhaps you have page nav areas at the top) to a point on the page
identified some other way, e.g.
document.getElementById('insertTOChere').firstChild.insertBefore

Hope this helps,
                          James


More information about the thelist mailing list