asp 二级分类
大家帮我看看怎么在这里添加个二级分类,后台已经可以了,就不知道前台如何实现,请大家赐教。能解决的追加100分。<tdwidth="210"height="430"alig...
大家帮我看看怎么在这里添加个二级分类,后台已经可以了,就不知道前台如何实现,请大家赐教。能解决的追加100分。
<td width="210" height="430" align="center" valign="top" background="Images/company/leftbg.gif" class="bg02"><table width="183" height="38" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="183" height="38" align="left" valign="top"><table width="170" height="29" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="29" align="left" valign="bottom"><img src="Images/company/quickmenu.gif" width="114" height="13" /></td>
</tr>
</table></td>
</tr>
</table>
<table width="183" height="77" border="0" cellpadding="0" cellspacing="0">
<%
bid = request("id")
if bid = "" then bid =20
dim ParentID,File
ParentID = 112
Set rst2=server.CreateObject("adodb.recordset")
strSql2="SELECT * FROM AdminMenu where ParentID="&ParentID&" order by SortNum ASC "
rst2.open strSQL2,conn,1,1
if rst2.recordcount>0 then
result=rst2.recordcount
For i=1 to result
File = Split(rst2("AdminMenuFile"),"=")
id = File(1)
%>
<%
if bid <> id then
bg="Images/company/menubg2.gif"
else
bg="Images/company/menubg1.gif"
end if
%>
<tr>
<td width="183" height="37" align="center" valign="top" background="<%=bg%>" class="bg01"><table width="118" height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="118" height="27" align="left" valign="middle" class="zi03"><a href="news.asp?id=<%=id%>" class="zi03"><%=rst2("AdminMenu")%></a></td>
</tr>
</table></td>
</tr>
<%
rst2.MoveNext
Next
end if
rst2.close
%>
</table></td> 展开
<td width="210" height="430" align="center" valign="top" background="Images/company/leftbg.gif" class="bg02"><table width="183" height="38" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="183" height="38" align="left" valign="top"><table width="170" height="29" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="29" align="left" valign="bottom"><img src="Images/company/quickmenu.gif" width="114" height="13" /></td>
</tr>
</table></td>
</tr>
</table>
<table width="183" height="77" border="0" cellpadding="0" cellspacing="0">
<%
bid = request("id")
if bid = "" then bid =20
dim ParentID,File
ParentID = 112
Set rst2=server.CreateObject("adodb.recordset")
strSql2="SELECT * FROM AdminMenu where ParentID="&ParentID&" order by SortNum ASC "
rst2.open strSQL2,conn,1,1
if rst2.recordcount>0 then
result=rst2.recordcount
For i=1 to result
File = Split(rst2("AdminMenuFile"),"=")
id = File(1)
%>
<%
if bid <> id then
bg="Images/company/menubg2.gif"
else
bg="Images/company/menubg1.gif"
end if
%>
<tr>
<td width="183" height="37" align="center" valign="top" background="<%=bg%>" class="bg01"><table width="118" height="27" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="118" height="27" align="left" valign="middle" class="zi03"><a href="news.asp?id=<%=id%>" class="zi03"><%=rst2("AdminMenu")%></a></td>
</tr>
</table></td>
</tr>
<%
rst2.MoveNext
Next
end if
rst2.close
%>
</table></td> 展开
2个回答
展开全部
不知道你的数据库结构,不好帮你写。大体是这么个思路:
先族指取出所有一级类来,循环显示;在一级类里,取出该类下的二级类,再循环显示。
代码示例:
<%rs.open "select * from bigclass",conn,1,1
for i=1 to rs.recordcount%>
<tr><td><%=rs("bigclass_name")%></兆竖配td></tr>
<%rs2.open "select * from smallclass where bigclass_id="&rs("bigclass_id"),conn,1,1
for j=1 to rs2.recordcount%>
<tr><td>—<%=rs2("smallclass_name")%></td><纤源/tr>
<%rs2.movenext
next
rs2.close
rs.movenext
next
rs.close%>
先族指取出所有一级类来,循环显示;在一级类里,取出该类下的二级类,再循环显示。
代码示例:
<%rs.open "select * from bigclass",conn,1,1
for i=1 to rs.recordcount%>
<tr><td><%=rs("bigclass_name")%></兆竖配td></tr>
<%rs2.open "select * from smallclass where bigclass_id="&rs("bigclass_id"),conn,1,1
for j=1 to rs2.recordcount%>
<tr><td>—<%=rs2("smallclass_name")%></td><纤源/tr>
<%rs2.movenext
next
rs2.close
rs.movenext
next
rs.close%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
北京磐安云创科技有限公司_
2023-02-01 广告
2023-02-01 广告
价格只是购买产品或服务过程中的一项指标,如果单纯只比较价格,其实考虑并不是那么周到。价格、质量、服务、口碑、是否合适自己的情况等都需要一起考虑。以上回答如果还觉得不够详细,可以来咨询下北京磐安公司。北京磐安公司是一家专业从事高新软件的技术公...
点击进入详情页
本回答由北京磐安云创科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询