二级树形菜单打开时再点其他菜单时如何将以前的子菜单自动缩回?
这是我现在做的二级树形菜单不能缩的代码,如何让其自动再缩回去?
<html><head>
</head>
<body>
<script>
var he=document.body.clientHeight
document.write("<div id=tt style=height:"+he+";overflow:hidden>")
</script>
<table cellpadding="0" cellspacing="0">
<tr>
<td width="130" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(3)" onmouseover="this.className='menu_title2';" onmouseout="this.className='menu_title';"><a href="#"><img src="images/index_images/index_button_0002.gif" name="Image21" width="130" height="15" border="0" id="Image21"></a></td>
</tr>
<tr>
<td id="submenu3" style="DISPLAY: none"><div style="WIDTH: 130px">
<table cellspacing="0" cellpadding="0" width="80%" >
<tr>
<td height="15"><a href="index.htm"><img src="images/button-02/01_1.gif" name="Image121" width="130" height="15" border="0" id="Image1"></a></td>
</tr>
<tr>
<td > <a href="index.htm"><img src="images/button-02/03_1.gif" name="Image12" width="130" height="30" border="0" id="Image1"></a></td>
</tr>
</table>
</div></td>
</tr>
</table>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" width="130" align="left">
<tr>
<td width="130" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(4)" onmouseover="this.className='menu_title2';" onmouseout="this.className='menu_title';" ><img src="images/index_images/index_button_0009.gif" name="Image91" width="130" id="Image31"></td>
</tr>
<tr>
<td id="submenu4" style="DISPLAY: none"><div style="WIDTH: 130px">
<table cellspacing="0" cellpadding="0" width="130" >
<tr>
<td width="130" height="15"><a href="index.htm"><img src="images/button-02/34_1.gif" name="Image12321111131211" width="130" border="0" id="Image1"></a></td>
</tr>
<tr>
<td ><a href="index.htm"><img src="images/button-02/31_1.gif" name="Image123211111311" width="130" border="0" id="Image1"></a></td>
</tr>
<tr>
<td ><a href="index.htm"><img src="images/button-02/34_1.gif" name="Image12321111131212" width="130" height="23" border="0" id="Image1"></a></td>
</tr>
</table>
</div></td>
</tr>
</table>
<script>
function aa(Dir)
{tt.doScroll(Dir);Timer=setTimeout('aa("'+Dir+'")',100)}//这里100为滚动速度
function StopScroll(){if(Timer!=null)clearTimeout(Timer)}
function initIt(){
divColl=document.all.tags("DIV");
for(i=0; i<divColl.length; i++) {
whichEl=divColl(i);
if(whichEl.className=="child")whichEl.style.display="none";}
}
function expands(el) {
whichEl1=eval(el+"Child");
if (whichEl1.style.display=="none"){
initIt();
whichEl1.style.display="block";
}else{whichEl1.style.display="none";}
}
var tree= 0;
function loadThreadFollow(){
if (tree==0){
document.frames["hiddenframe"].location.replace("tree.asp");
tree=1
}
}
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
}
}
</script>