动态的二级伸缩式的菜单,asp编写

发表于:2007-06-30来源:作者:点击数: 标签:
这是本来的静态的二级菜单 META http-equiv=Content-Type content=text/html; charset=gb2312 LINK href=admin/adminstyle.css type=text/css rel=stylesheet SCRIPT function aa(Dir) {tt.doScroll(Dir);Timer=setTimeout(‘’aa(‘’+Dir+‘’)‘’,100)}//
这是本来的静态的二级菜单

<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="admin/adminstyle.css" type="text/css" rel="stylesheet">
<SCRIPT>
function aa(Dir)
{tt.doScroll(Dir);Timer=setTimeout(‘’aa("‘’+Dir+‘’")‘’,100)}//这里100为滚动速度
function StopScroll(){if(Timer!=null)clearTimeout(Timer)}

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>

<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<center>
<script>
var he=document.body.clientHeight-105
document.write("<div id=tt style=height:"+he+";overflow:hidden>")
</script>
<TABLE cellSpacing="1" cellPadding="0" width="140" align="center" class="a2" ID="Table3">
<TBODY>
<TR align="center" class="a1">
<TD width="140" height="25" align="center" bgcolor="#6381C1" class="menu_title" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(0)" onmouseover="this.className=‘’menu_title2‘’;"
onmouseout="this.className=‘’menu_title‘’;"><SPAN><span class="style1">四撑杆两瓣抓斗</span>
</SPAN></TD>
</TR>
<TR align="center" class="a3">
<TD id="submenu0" style="DISPLAY: none">
<DIV class="sec_menu" style="WIDTH: 140px">
<TABLE cellSpacing="0" cellPadding="0" width="90%" align="center" ID="Table4">
<TBODY>
<TR align="center">
<TD height="20">
<a target="main" href="admin_config.asp">网站基本数据</a>
</TR>
<TR align="center">
<TD height="20">
<a target="main" href="admin_admin.asp?action=admin">管理员管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="book.asp" target="_blank">留言本管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a target="main" href="admin_admin.asp?action=modpass">更改管理员密码</a>
</TR>
<TR align="center">
<TD height="20">
<a target="main" href="admin_recount.asp">更新首页统计数</a>
</TR>
</TBODY></TABLE>
</DIV>
</TD>
</TR>
</TBODY></TABLE>
<TABLE width="140" align="center" cellPadding="0" cellSpacing="1" class="a2" ID="Table5">
<TBODY>
<TR align="center" class="a1">
<TD height="25" align="center" bgcolor="#6381C1" class="menu_title" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(3)" onmouseover="this.className=‘’menu_title2‘’;"
onmouseout="this.className=‘’menu_title‘’;"><SPAN class="style1">四撑杆两瓣抓斗
</SPAN></TD>
</TR>
<TR align="center" class="a3">
<TD id="submenu3" style="DISPLAY: none">
<DIV class="sec_menu" style="WIDTH: 130px">
<TABLE cellSpacing="0" cellPadding="0" width="90%" align="center" ID="Table6">
<TBODY>
<TR align="center">
<TD height="20">
<a href="admin_diary.asp" target="main">公告管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_diary.asp?action=newdiary" target="main">新添公告</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_vote.asp?action=vote" target="main">投票管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_vote.asp?action=newvote" target="main">新添投票</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_news.aspx" target="main">新闻管理</a> | <a href="admin_news.aspx" target="main">添加</a></TD>
</TR>

</TBODY></TABLE>
</DIV>
</TD>
</TR>
</TBODY></TABLE>
<TABLE cellSpacing="1" cellPadding="0" width="140" align="center" class="a2" ID="Table7">
<TBODY>
<TR align="center" class="a1">
<TD height="25" align="center" bgcolor="#6381C1" class="menu_title style1" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(2)" onmouseover="this.className=‘’menu_title2‘’;"
onmouseout="this.className=‘’menu_title‘’;">弹性平衡异步多颚板抓斗</TD>
</TR>
<TR align="center" class="a3">
<TD id="submenu2" style="DISPLAY: none">
<DIV class="sec_menu" style="WIDTH: 140px">
<TABLE cellSpacing="0" cellPadding="0" width="90%" align="center" ID="Table8">
<TBODY>
<TR align="center">
<TD height="20">
<a href="admin_mms.aspx" target="main">彩信管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_dj.asp?action=djerror" target="main">彩铃管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_dj.asp?action=newdj" target="main">新增影音</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_dj.asp?action=djcat" target="main">分类管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_dj.asp?action=newdjcat" target="main">新增分类</a></TD>
</TR>
</TBODY></TABLE>
</DIV>
</TD>
</TR>
<TR align="center" class="a1">
<TD height="25" align="center" bgcolor="#6381C1" class="menu_title" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(6)" onmouseover="this.className=‘’menu_title2‘’;"
onmouseout="this.className=‘’menu_title‘’;"><span class="style1">防漏抓斗</span></TD>
</TR>
<TR align="center" class="a3">
<TD id="submenu6" style="DISPLAY: none">
<DIV class="sec_menu" style="WIDTH: 140px">
<TABLE cellSpacing="0" cellPadding="0" width="90%" align="center" ID="Table9">
<TBODY>
<TR align="center">
<TD height="19">
<a href="admin_article.asp" target="main">分类管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_article2.asp" target="main">文章管理</a></TD>
</TR>
<TR align="center">
<TD height="19">
<a href="admin_article.asp?action=newartcat" target="main">新增分类</a></TD>
</TR>
<TR align="center">
<TD height="19">
<a href="New_article.asp?action=newart" target="main">新增文章</a></TD>
</TR>
</TBODY></TABLE>
</DIV>
</TD>
</TR>
</TBODY></TABLE>
<TABLE cellSpacing="1" cellPadding="0" width="140" align="center" class="a2" ID="Table10">
<TBODY>
<TR align="center" class="a1">
<TD height="25" align="center" bgcolor="#6381C1" class="menu_title" id="menuTitle1" style="cursor:hand" onclick="showsubmenu(4)" onmouseover="this.className=‘’menu_title2‘’;"
onmouseout="this.className=‘’menu_title‘’;"><SPAN><span class="style1">其他相关产品</span>&nbsp;</SPAN></TD>
</TR>
<TR align="center" class="a3">
<TD id="submenu4" style="DISPLAY: none">
<DIV class="sec_menu" style="WIDTH: 140px">
<TABLE cellSpacing="0" cellPadding="0" width="90%" align="center" ID="Table11">
<TBODY>
<TR align="center">
<TD height="20">
<a href="admin_pic.asp?action=piclearcase/" target="_blank" >ccat" target="main">分类管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_pic.asp?action=newpiccat" target="main">新增分类</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_pic.asp?action=pic" target="main">图片管理</a></TD>
</TR>
<TR align="center">
<TD height="20">
<a href="admin_pic.asp?action=newpic" target="main">新增图片</a>
</TD>
</TR>
</TBODY></TABLE>
</DIV>
</TD>
</TR>
</TBODY></TABLE>
&nbsp;



asp 动态二级菜单

<p>
<%
set CatRs = Server.CreateObject("ADODB.Recordset")

CatRsSql = "SELECT * FROM CN_Category"

CatRs.Open CatRsSql,conn,1,1
tablenum=3
%>
<% Do While Not CatRs.Eof %>
<%
If Not CatRs.Eof Then ‘’ http://localhost/Double/product.asp?SubCategoryID=731
Response.Write "<TABLE cellSpacing=‘’1‘’ cellPadding=‘’0‘’ width=‘’140‘’ align=‘’center‘’ class=‘’a2‘’ ID=‘’Table"&tablenum&"‘’>"
tablenum=tablenum+1
Response.Write "<TBODY>"
Response.Write "<TR align=‘’center‘’ class=‘’a1‘’>"
Response.Write "<TD width=‘’140‘’ height=‘’25‘’ align=‘’center‘’ bgcolor=‘’#6381C1‘’ class=‘’menu_title‘’ id=‘’menuTitle1‘’ style=‘’cursor:hand‘’ onclick=‘’showsubmenu("&tablenum&")‘’ <SPAN><span class=‘’style1‘’>"
‘’Response.Write "<a href=‘’product.asp?CategoryID=" & CatRs("ID") & "‘’>" & CatRs("CateName") & "</a>"
Response.Write CatRs("CateName")
Response.Write"</span> </SPAN></TD>"
Response.Write "</TR>"
Response.Write "<TR align=‘’center‘’ class=‘’a3‘’>"
Response.Write "<TD id=‘’submenu"&tablenum&"‘’ style=‘’DISPLAY: none‘’><DIV class=‘’sec_menu‘’ style=‘’WIDTH: 140px‘’>"
Response.Write "<TABLE cellSpacing=‘’0‘’ cellPadding=‘’0‘’ width=‘’90%‘’ align=‘’center‘’ ID=‘’Table"&tablenum&"‘’>"
tablenum=tablenum+1
Response.Write "<TBODY>"
set SubRs = Server.CreateObject("ADODB.Recordset")
SubRsSql = "SELECT * FROM CN_SubCategory where CategoryID="&CatRs("id")
SubRs.Open SubRsSql,conn,1,1
Do While Not SubRs.Eof
If Not SubRs.Eof Then
Response.Write "<TR align=‘’center‘’>"

Response.Write "<TD height=‘’20‘’><a target=‘’main‘’ href=‘’product.asp?SubCategoryID="&SubRs("ID")&"‘’>"&SubRs("SubCategory")&"</a></TD> "

Response.Write "</TR>"
SubRs.MoveNext
End If
Loop
SubRs.Close()
Response.Write "</TBODY>"
Response.Write "</TABLE>"
Response.Write "</DIV></TD>"
Response.Write "</TR>"
Response.Write " </TBODY>"
Response.Write " </TABLE>"

CatRs.MoveNext
End If
%>
<% Loop
CatRs.Close()
%>
</p>





原文转自:http://www.ltesting.net