求个JS写法
弄个菜单栏
也就是点击一栏目的时候 其他栏目隐藏 被点击的栏目子栏目显示
我是这样写的:
<SCRIPT language=javascript1.2>
function showsubmenu(sid)
{
for(var i=0;i<=10;i++)
{
if(i==sid)
{
$("#submenu"+sid).fadeIn(1000);
eval("menuTitle" + sid + ".style.backgroundImage=\"url(images/admin_left_1.gif)\";");
}
else
{
$("#submenu"+i).fadeOut(0);
eval("menuTitle" + i + ".style.backgroundImage=\"url(images/admin_left.gif)\";");
}
}
}
</SCRIPT>
HTML部分:
<table cellpadding=0 cellspacing=0 align=center class="menuclx">
<tr>
<td height=25 class=menu_title id=menuTitle1 onClick="showsubmenu(0)" style="cursor:hand;"><a href="#">用户基本操作</a> </td>
</tr>
<tr >
<td >
<table cellpadding=0 cellspacing=0 align=center class=sec_menu id='submenu0' >
<tr>
<td height=20><a href="site_setting.asp" target="main">站点信息管理</a></td>
<tr>
<tr>
<td height="20"><a href="news_center.asp" target="main">新闻信息管理</a></td>
</tr>
<tr>
<td height="20"><a href="single_info.asp" target="main">单页信息管理</a></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 align=center class="menuclx">
<tr>
<td height=25 class=menu_title id=menuTitle3 onClick="showsubmenu(1)" style="cursor:hand;"><a href="#">新闻管理中心</a> </td>
</tr>
<tr>
<td >
<table cellpadding=0 cellspacing=0 align=center class=sec_menu id='submenu1' style="display:none" >
<tr>
<td height=20><a href="news_class.asp" target="main">新闻栏目管理</a></td>
</tr>
<tr>
<td height=20><a href="news_center.asp" target="main">新闻管理中心</a></td>
</tr>
<tr>
<td height=20><a href="news_add.asp" target="main">快速发布新闻</a></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 align=center class="menuclx">
<tr>
<td height=25 class=menu_title id=menuTitle5 onClick="showsubmenu(3)" style="cursor:hand;"><a href="#">单页信息管理</a> </td>
</tr>
<tr>
<td >
<table cellpadding=0 cellspacing=0 align=center class=sec_menu id='submenu3' style="display:none" >
<tr>
<td height=20><a href="single_info.asp" target="main"&g