ReportingAnalyst
MIS
Hi,
I am building a tree with nested UL with several nested branches.
Is there a way I can add an id to a <a href> tag so that when I click on the <a> tag, then it expands based on the ElementID I clicked on. Or should I be using the UL id to expand on or collapse?
My UL code:
My Javascript function is:
I want to take out the <span> tags are they are inline and block level elements. Since the Javascript refers to an id, what do I associate this id with? Which element?
Thanks.
I am building a tree with nested UL with several nested branches.
Is there a way I can add an id to a <a href> tag so that when I click on the <a> tag, then it expands based on the ElementID I clicked on. Or should I be using the UL id to expand on or collapse?
My UL code:
Code:
<ul id="menu">
<li>
<a href="#" onclick="s_Hide('4655'); return false;">Mgr1</a>
<span id="4655" style="display: none">
<ul onClick="">
<li><a href="#">Mgr1</a></li>
<ul onClick="">
<li>Sub1</li>
<li>Sub2</li>
<li>Sub3</li>
</ul>
<li><a href="#">Mgr2</a></li>
<ul onClick="">
<li>Sub4</li>
<li>Sub5</li>
</ul>
<li><a href="#">Mgr3</a></li>
<ul onClick="">
<li>Sub6</li>
</ul>
<li>Sub7</li>
</ul>
</li>
</ul>
My Javascript function is:
Code:
function s_Hide(el){
obj = document.getElementById(el).style;
(obj.display == 'none')? obj.display = 'block' : obj.display = 'none';
}
I want to take out the <span> tags are they are inline and block level elements. Since the Javascript refers to an id, what do I associate this id with? Which element?
Thanks.