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个回答
展开全部
写的太复杂了吧 递归一下就可以了 你这一大屏 ……
追问
我这个图是我现在实现的效果,我想问一下我怎么可以实现单独显示其中一个类别?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
北京磐安云创科技有限公司_
2023-02-01 广告
2023-02-01 广告
价格只是购买产品或服务过程中的一项指标,如果单纯只比较价格,其实考虑并不是那么周到。价格、质量、服务、口碑、是否合适自己的情况等都需要一起考虑。以上回答如果还觉得不够详细,可以来咨询下北京磐安公司。北京磐安公司是一家专业从事高新软件的技术公...
点击进入详情页
本回答由北京磐安云创科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询