The purpose of this whole thing is to build an online HTML editor with simple support for TABLEs, Ps, SPANs, Bs, As, and a few pre-defined CSS styles.
After the HTML is parsed, it is regenerated from the tree for viewing in a preview window. I have the DIVs because I want a way to highlight the various elements of the page. When the user clicks (or double clicks) inside one of these DIVs, it will refresh the page with another parameter ($nodeid) that tells which element in the page they selected.
I am doing all of this because my boss (uses Frontpage and loves the <BLINK> tag) insists on being able to edit content on our new HTML::Mason based site.
Comment on Re^4: tracking where I am in a tree structure
Good Luck, I can't even begin to think of what would be the best way to go about all that. It has also been a while since I was really up to date with the whole DHTML thing. Best advice I can give, is don't listen to me, and 1) try things out to see what works, 2) find a good DHTML/Javascript mailing-list/board like this one to bounce things off of.