asp 无限级分类,类别显示问题? 30
FunctionFolder(ParentID,i,Level)dimrs,sqldimChildCount,FolderType,FolderName,onMouseU...
Function Folder(ParentID,i,Level)
dim rs,sql
dim ChildCount,FolderType,FolderName,onMouseUp
set rs = server.createobject("adodb.recordset")
sql="select * from NwebCn_ProductSort where ViewFlag and ParentID="&ParentID&" order by ID desc"
rs.open sql,conn,1,1
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID=0").eof then
response.write "暂无相关信息"
end if
response.write("<div class=""menu"">")
response.write("<ul>")
do while not rs.eof
if i=0 then
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<div class=""Bodyer_left_page_title""><a class=""white_l"" href=""productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></div>"
else
response.write "<div class=""Bodyer_left_page_title""><a class=""white_l"" href=""productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></div>"
end if
elseif i=1 then
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<li><div class=""small_menu_txt""><span class=""yangshi""><a href=""Productlist.asp?SortID="&rs("ID")&""">+ "&rs("SortName")&"</a></span></div></li>"
else
response.write "<li><div class=""small_menu_txt""><span class=""yangshi""><a href='#'>+ "&rs("SortName")&"</a></span>"
end if
else
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<div class=""small_menu_box""><li><span class=""yang""><a href=""Productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></span></li></div>"
end if
end if
i=i+1
if i<Level and not conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then call Folder(rs("ID"),i,Level)
i=i-1
if not conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then response.write("</div></li>")
rs.movenext
loop
response.write("</li>")
response.write("</ul>")
response.write("</div>")
rs.close
set rs=nothing
end function 展开
dim rs,sql
dim ChildCount,FolderType,FolderName,onMouseUp
set rs = server.createobject("adodb.recordset")
sql="select * from NwebCn_ProductSort where ViewFlag and ParentID="&ParentID&" order by ID desc"
rs.open sql,conn,1,1
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID=0").eof then
response.write "暂无相关信息"
end if
response.write("<div class=""menu"">")
response.write("<ul>")
do while not rs.eof
if i=0 then
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<div class=""Bodyer_left_page_title""><a class=""white_l"" href=""productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></div>"
else
response.write "<div class=""Bodyer_left_page_title""><a class=""white_l"" href=""productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></div>"
end if
elseif i=1 then
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<li><div class=""small_menu_txt""><span class=""yangshi""><a href=""Productlist.asp?SortID="&rs("ID")&""">+ "&rs("SortName")&"</a></span></div></li>"
else
response.write "<li><div class=""small_menu_txt""><span class=""yangshi""><a href='#'>+ "&rs("SortName")&"</a></span>"
end if
else
if conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then
response.write "<div class=""small_menu_box""><li><span class=""yang""><a href=""Productlist.asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></span></li></div>"
end if
end if
i=i+1
if i<Level and not conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then call Folder(rs("ID"),i,Level)
i=i-1
if not conn.execute("select * from NwebCn_ProductSort Where ViewFlag and ParentID="&rs("ID")&"").eof then response.write("</div></li>")
rs.movenext
loop
response.write("</li>")
response.write("</ul>")
response.write("</div>")
rs.close
set rs=nothing
end function 展开
1个回答
展开全部
写的太复杂了吧 递归一下就可以了 你这一大屏 ……
追问
我这个图是我现在实现的效果,我想问一下我怎么可以实现单独显示其中一个类别?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询