[thelist] operating on DOM Nodes (collapsible tree)
Aleem Bawany
aleem.bawany at utoronto.ca
Thu Feb 20 02:56:01 CST 2003
I am trying to implement a collapsable tree:
<ul>
<li> one </li>
<ul>
<li> two </li>
</ul>
</ul>
so clicking on list item one should toggle the 'display'
property of the second list. I looked up the 'node'
interface [1] and nextSibling seems to fit the bill,
so I can create a javascript without having to explicitly
tie an event listen on each object but through one script.
I can't seem to do much with the node interface. I want
something like:
this.nextSibling.style.display = 'none';
I thought something like:
document.getElementById(this.nextSibiling).style.display
might help me get on my way, but no luck (are nodes and elements
the same thing?).
How would I tie up nodes and styles (The previous thread inspired
me to take this approach). How is this done typically?
In the past I would assign an id to each list and deal with it,
but now I'm certain there are much better ways.
thanks,
aleem
[ http://members.evolt.org/aleem/ ]
More information about the thelist
mailing list