/    Sign up×
Community /Pin to ProfileBookmark

Collapsing/Expanding() All nodes in a TreeMenu using javascript

Hi,

I am trying to do a TreeMenu in jsp.
Can anyone help me/give me a clue to write ExpandALLNodes() and CollapseALLNodes() functions in javascript in a TreeMenu.Such that all the treemenu nodes(parent/child nodes) should collapse/expand when a button is clicked.

Thank you,
Hadley

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@MrNobodyJan 30.2009 — The general outline is:
[CODE]var parent = document.getElementById(id);
var children = parent.getElementsByTagName(tag);
var x, child, len = children.length;
for (x=0; x<len; ++x)
{
child = children[x];
// do what needs to be done to child
}[/CODE]
Copy linkTweet thisAlerts:
@HadleyauthorFeb 01.2009 — Hi,

Iam trying to expand entire tree menu when a expand button is clicked.Could you please explain me how to write a function to expand entire treemenu.

Thank you
Copy linkTweet thisAlerts:
@MrNobodyFeb 01.2009 — What I posted is the basis for such a function. I'm not going to simply write all the code for you. Make some effort of your own. If you run into troubles, post back and I'll help out.
×

Success!

Help @Hadley spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...