Closed Thread Icon

Topic awaiting preservation: How to get a sub-item? Pages that link to <a href="https://ozoneasylum.com/backlink?for=27291" title="Pages that link to Topic awaiting preservation: How to get a sub-item?" rel="nofollow" >Topic awaiting preservation: How to get a sub-item?\

 
Author Thread
u-neek
Bipolar (III) Inmate

From: Berlin, Germany
Insane since: Jan 2001

posted posted 01-09-2006 19:36

Hi!

Let's assume we have the following list:

code:
<ul id="item1">
    <li>Name1
    <ul>
        <li>Sub-Name1</li>
        <li>Sub-Name2</li>
    </ul>
</ul>


Is it possible to hide the child-list?
I get the parent-list with document.getElementById('item1'), but how do i select the child-list?

Thanks for your response.

kuckus
Paranoid (IV) Mad Librarian

From: Glieberlermany
Insane since: Dec 2001

posted posted 01-09-2006 19:57

Hi u-neek,

try:

code:
document.getElementById('item1').childNodes[1].style.


http://de.selfhtml.org/javascript/objekte/node.htm#child_nodes

You could also loop through all the parent list's child nodes and check which of them is the <ul> - this would work better esp. if it isn't always the second.


edit: some more info here: this.bgColor='#000000'

(Edited by kuckus on 01-09-2006 19:59)

« BackwardsOnwards »

Show Forum Drop Down Menu