In article <7facn10ykyyp.14wddnrgxeu0$.dlg@40tude.net>,
alvaro_QUITAR_REMOVE@telecomputeronline.com enlightened us with...[color=blue]
> I have a list built on HTML and CSS:
>
> <ul>
> <li>Foo</li>
> <li>Bar
> <ul>
> <li>Gee</li>
> </ul>
> </li>
> </ul>
>
> I need a script to expand and collapse items so only one sublist is visible
> at a time.[/color]
Will this do?
<html>
<head>
<title> New Document </title>
<script type="text/javascript">
function showHide(id)
{
if (document.getElementById)
{
if (document.getElementById(id).style.visibility == "visible"
|| document.getElementById(id).style.visibility == "")
{
// hide it
document.getElementById(id).style.visibility = "hidden";
document.getElementById(id).style.display = "none";
}
else
{
// show it
document.getElementById(id).style.visibility = "visible";
document.getElementById(id).style.display = "";
}
}
}
</script>
</head>
<body>
<p>This is a test. Click on high-level LI to hide sub-LI. Click again to
show.</p>
<ul>
<li><a onClick="showHide('tier1')";>one</a></li>
<ul id="tier1">
<li>aaa</li>
<li>bbb</li>
<li>ccc</li>
</ul>
<li><a onClick="showHide('tier2')";>two</a></li>
<ul id="tier2">
<li>ddd</li>
<li>eee</li>
<li>fff</li>
</ul>
<li><a onClick="showHide('tier3')";>three</a></li>
<ul id="tier3">
<li>ggg</li>
<li>hhh</li>
<li>iii</li>
</ul>
</ul>
</body>
</html>
--
--
~kaeli~
Have you forgotten about Jesus? Isn't it about time you did?
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace