我有一个这样的代码,一个菜单导航,现在要改成:默认的一个菜单(A)是打开的。另一个(B)是关闭的,如下面的代码。点击B后,A收缩回去,B展开。请问怎么改。现在没有分了。以后给补上,谢谢各位了。页面:代码。
<TABLE cellSpacing=0 cellPadding=0 width=158 align=center>
<TBODY>
<TR style="CURSOR: hand">
<TD class=menu_title id=menuTitle1 onMouseOver="this.className='menu_title2';" onClick="menuChange(menu1,60,menuTitle1);" onMouseOut="this.className='menu_title';" background="images/menu/menuup.gif" height=25 style="font-size:12px;"><SPAN>网站常规设置</SPAN> </TD>
</TR>
<TR>
<TD>
<DIV class=sec_menu id=menu1 style="DISPLAY: none; FILTER: alpha(Opacity=0); WIDTH: 158px; HEIGHT: 0px">
<TABLE style="POSITION: relative; top: 10px;" cellSpacing=0 cellPadding=0 width=135 align=center>
<TBODY>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="./index.jsp" target=_parent style="font-size:12px;">返回首页</a></td>
</tr>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/quit.jsp" target="_parent" style="font-size:12px;">注销登陆</a></td>
</tr>
</TBODY>
</TABLE>
</DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=158 align=center>
<TBODY>
<TR style="CURSOR: hand">
<TD class=menu_title id=menuTitle2 onMouseOver="this.className='menu_title2';" onClick="menuChange(menu2,60,menuTitle2);" onMouseOut="this.className='menu_title';" background="images/menu/menuup.gif" height=25 style="font-size:12px;"><SPAN>网站栏目管理</SPAN> </TD>
</TR>
<TR>
<TD>
<DIV class=sec_menu id=menu2 style="DISPLAY: none; FILTER: alpha(Opacity=0); WIDTH: 158px; HEIGHT: 0px">
<TABLE style="POSITION: relative; top: 10px;" cellSpacing=0 cellPadding=0 width=135 align=center>
<TBODY>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/models/modelcount.jsp" target="right" style="font-size:12px;">栏目统计</a></td>
</tr>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/models/seeModels.jsp" target="right" style="font-size:12px;">栏目浏览</a></td>
</tr>
</TBODY>
</TABLE>
</DIV></TD></TR></TBODY></TABLE>
<script language="javascript">
var whichOpen="";
var whichContinue='';
function menuShow(obj,maxh,obj2)//显示框
{
if(obj.style.pixelHeight<maxh)
{
obj.style.pixelHeight+=maxh/20;
obj.filters.alpha.opacity+=5;
obj2.background="";
if(obj.style.pixelHeight==maxh/10)
obj.style.display='block';
myObj=obj;
myMaxh=maxh;
myObj2=obj2;
setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
}
}
function menuHide(obj,maxh,obj2)//隐藏框
{
if(obj.style.pixelHeight>0)
{
if(obj.style.pixelHeight==maxh/20)
obj.style.display='none';
obj.style.pixelHeight-=maxh/20;
obj.filters.alpha.opacity-=5;
obj2.background="";
myObj=obj;
myMaxh=maxh
myObj2=obj2;
setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
}
else
if(whichContinue)
whichContinue.click();
}
function menuChange(obj,maxh,obj2)
{
if(obj.style.pixelHeight)
{
menuHide(obj,maxh,obj2);
whichOpen='';
whichcontinue='';
}
else
if(whichOpen)
{
whichContinue=obj2;
whichOpen.click();
}
else
{
menuShow(obj,maxh,obj2);
whichOpen=obj2;
whichContinue='';
}
}
</script>
<TABLE cellSpacing=0 cellPadding=0 width=158 align=center>
<TBODY>
<TR style="CURSOR: hand">
<TD class=menu_title id=menuTitle1 onMouseOver="this.className='menu_title2';" onClick="menuChange(menu1,60,menuTitle1);" onMouseOut="this.className='menu_title';" background="images/menu/menuup.gif" height=25 style="font-size:12px;"><SPAN>网站常规设置</SPAN> </TD>
</TR>
<TR>
<TD>
<DIV class=sec_menu id=menu1 style="DISPLAY: none; FILTER: alpha(Opacity=0); WIDTH: 158px; HEIGHT: 0px">
<TABLE style="POSITION: relative; top: 10px;" cellSpacing=0 cellPadding=0 width=135 align=center>
<TBODY>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="./index.jsp" target=_parent style="font-size:12px;">返回首页</a></td>
</tr>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/quit.jsp" target="_parent" style="font-size:12px;">注销登陆</a></td>
</tr>
</TBODY>
</TABLE>
</DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=158 align=center>
<TBODY>
<TR style="CURSOR: hand">
<TD class=menu_title id=menuTitle2 onMouseOver="this.className='menu_title2';" onClick="menuChange(menu2,60,menuTitle2);" onMouseOut="this.className='menu_title';" background="images/menu/menuup.gif" height=25 style="font-size:12px;"><SPAN>网站栏目管理</SPAN> </TD>
</TR>
<TR>
<TD>
<DIV class=sec_menu id=menu2 style="DISPLAY: none; FILTER: alpha(Opacity=0); WIDTH: 158px; HEIGHT: 0px">
<TABLE style="POSITION: relative; top: 10px;" cellSpacing=0 cellPadding=0 width=135 align=center>
<TBODY>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/models/modelcount.jsp" target="right" style="font-size:12px;">栏目统计</a></td>
</tr>
<tr>
<td height="20"><img src="images/menu/bullet.gif" width="15" height="20" border="0" align="absmiddle"><a href="admin/models/seeModels.jsp" target="right" style="font-size:12px;">栏目浏览</a></td>
</tr>
</TBODY>
</TABLE>
</DIV></TD></TR></TBODY></TABLE>
<script language="javascript">
var whichOpen="";
var whichContinue='';
function menuShow(obj,maxh,obj2)//显示框
{
if(obj.style.pixelHeight<maxh)
{
obj.style.pixelHeight+=maxh/20;
obj.filters.alpha.opacity+=5;
obj2.background="";
if(obj.style.pixelHeight==maxh/10)
obj.style.display='block';
myObj=obj;
myMaxh=maxh;
myObj2=obj2;
setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
}
}
function menuHide(obj,maxh,obj2)//隐藏框
{
if(obj.style.pixelHeight>0)
{
if(obj.style.pixelHeight==maxh/20)
obj.style.display='none';
obj.style.pixelHeight-=maxh/20;
obj.filters.alpha.opacity-=5;
obj2.background="";
myObj=obj;
myMaxh=maxh
myObj2=obj2;
setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
}
else
if(whichContinue)
whichContinue.click();
}
function menuChange(obj,maxh,obj2)
{
if(obj.style.pixelHeight)
{
menuHide(obj,maxh,obj2);
whichOpen='';
whichcontinue='';
}
else
if(whichOpen)
{
whichContinue=obj2;
whichOpen.click();
}
else
{
menuShow(obj,maxh,obj2);
whichOpen=obj2;
whichContinue='';
}
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货