Hi,
The below code gives a Treeview of Items and their sub-items,.. It shows in the hierarchical format,... but instead of hard-coding the input Item 1 , Sub-item 1 etc,..., i wanna give an input so that it will become a generic code and show the hierarchical tree view for any input we give,..
I tried giving some variables but it didn't work for me..
1)Could you please suggest me on this.. and also do u have any other ideas to build a hierarchical tree using HTML/JAVASCRIPT..
2)I also tried using DOM but it didn't work,.. I didn't know how to use DOM properly, suggest me if you have any idea about DOM
<code>
<ul>
<li>
<a href="#" onclick="toggle('node1')">Item 1</a>
<ul id="node1" style="display:none">
<li>Sub-item 1</li>
<li>
<a href="#" onclick="toggle('node2')">Sub-item 2</a>
<ul id="node2" style="display:none">
<li>Sub-sub-item 1</li>
<li>Sub-sub-item 2</li>
</ul>
</li>
<li>Sub-item 3</li>
</ul>
</li>
<li>
<a href="#" onclick="toggle('node3')">Item 2</a>
<ul id="node3" style="display:none">
<li>Sub-item 1</li>
<li>Sub-item 2</li>
</ul>
</li>
<li>Item 3</li>
</ul>
</code>
Thanks in advance!