一个简单的JS循环。。。解决马上给分!附上【靓妹】图片!
<script language="JavaScript">
function show(ChildMenu1)
{
if (ChildMenu1.style.display == "none")
{
ChildMenu1.style.display = "";
}
else
{
ChildMenu1.style.display = "none";
}
}
function show(ChildMenu2)
{
if (ChildMenu2.style.display == "none")
{
ChildMenu2.style.display = "";
}
else
{
ChildMenu2.style.display = "none";
}
}
</script>
<html>
<head>
<script type='text/javascript'>
function show(menu)
{
if (menu.children[0].children[0].style.display != "none")
{
menu.children[0].children[0].style.display = "none";
}
else
{
menu.children[0].children[0].style.display = "block";
}
}
</script>
</head>
<body>
<ul onclick="show(this)">
<li>111111111
<ul style="display:none">
<li><a href="#">子菜单</a></li>
<li>子菜单</li>
<li>子菜单</li>
</ul>
</li>
</ul>
<ul onclick="show(this)">
<li>22222222222<ul style="display:none">
<li><a href="#">子菜单</a></li>
<li>子菜单</li>
<li>子菜单</li>
</ul></li>
</ul>
</body>
</html>