L
lejason
I am trying to make a tree menu that is similar to this
http://genieindustries.com/service_manuals.asp where you can click an
list item and it will un-hide another list. It seems simple
enough...but when I try it here http://www.wcumc.org/wcumc/w/content.php?type=info
it works in reverse. Meaning, it starts with the list fully expanded
and then by clicking on the parent, it collapses.
So, how do I get it to start closed and then open when its clicked?
I am kinda weak in JS so this is probably a VERY simple question
The relevant code I am working with goes like this -->
<script type="text/javascript" language="javascript">
function show( menu ) {
if( document.getElementById ) {
if( document.getElementById( menu ).style.display == 'block' ) {
document.getElementById( menu ).style.display = 'none';
} else {
document.getElementById( menu ).style.display = 'block';
}
} else if( document.all ) {
if( document.all[ menu ].style.display == 'block' ) {
document.all[ menu ].style.display = 'none';
} else {
document.all[ menu ].style.display = 'block';
}
}
}
</script>
and then to call it its just...
<ul>
<li><a href="javascript:show('menu11')">Test</a>
<ul id="menu11">
http://genieindustries.com/service_manuals.asp where you can click an
list item and it will un-hide another list. It seems simple
enough...but when I try it here http://www.wcumc.org/wcumc/w/content.php?type=info
it works in reverse. Meaning, it starts with the list fully expanded
and then by clicking on the parent, it collapses.
So, how do I get it to start closed and then open when its clicked?
I am kinda weak in JS so this is probably a VERY simple question
The relevant code I am working with goes like this -->
<script type="text/javascript" language="javascript">
function show( menu ) {
if( document.getElementById ) {
if( document.getElementById( menu ).style.display == 'block' ) {
document.getElementById( menu ).style.display = 'none';
} else {
document.getElementById( menu ).style.display = 'block';
}
} else if( document.all ) {
if( document.all[ menu ].style.display == 'block' ) {
document.all[ menu ].style.display = 'none';
} else {
document.all[ menu ].style.display = 'block';
}
}
}
</script>
and then to call it its just...
<ul>
<li><a href="javascript:show('menu11')">Test</a>
<ul id="menu11">