Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Taking User Input for building a Hierarchical Tree

user input

  • Please log in to reply
No replies to this topic

#1 swathisambaraj

swathisambaraj

    CC Lurker

  • Just Joined
  • Pip
  • 4 posts

Posted 23 June 2010 - 06:38 PM

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


<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>


Thanks in advance!
  • 0





Also tagged with one or more of these keywords: user input

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download