⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree1.asp

📁 这是一个物流网站的源代码
💻 ASP
字号:
<%
'无限级分类,树状显示代码。
'数据库字段:NS_Id——自动编号;分类ID
'            NS_Name——文本;类名
'            NS_Parentid——数字;上级ID
'            NS_Level——数字;分类级深(无用)
'            NS_Order——数字;分类排序
'///////////////////////////showtreeforline(table,sortid,rs,tree)/////////////////////////////
'函数名:showtreeforline
'作  用:用树状分级显示所有的分类
'参  数:
'       Table——要查找的表名
'       SortId——根目录的ID
'       Rs——数据集名
'       Tree——树状标志的形状
'返回值:无
'调用示范:showtreeforline "bbs",0,"rs"&cstr(NS_Id),""
'//////////////////////////////////showtreeforline(table,sortid,rs,tree)///////////////////////
sub showtreeforline(table,sortid,rs,tree)
  if len(tree)=0 then
     S_Isroot=0
  end if
  trees="1"
  treestr=tree&trees
  set rs=server.CreateObject("adodb.recordset")
  rs.open"select * from "&table&" where "&prefix&"Parentid="&sortid&" order by "&prefix&"Order asc",conn,1,1
  if rs.eof and tree="" then
     response.Write"	 <tr class='tdbg'><td><center>暂无分类</center></td></tr>"
  else
     do while not rs.eof 
	    NS_Name=rs(prefix&"Name")
	    NS_Id=rs(prefix&"Id")
        rs.movenext
	    if rs.eof then
	       trees="0"
	       treestr=tree&trees
	    end if
        response.Write"	 <tr class='tdbg'>"
		Response.Write("<TD vAlign=bottom width='5%'>"&NS_Id&"</td> ")
		Response.Write("<td valign='bottom' width='63%'>")
	    for i=0 to len(treestr)-2
	       if mid(treestr,i+1,1)="1" then
		      response.Write("<img src='../image/linee.GIF' align='absbottom'>")
	      	else
		      response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
		   end if
        next
	    if trees="0" then
		   if tree="" and S_Isroot=0 then
	          response.Write"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
		   else
	          response.Write"<img src='../image/treee1.GIF' align='absbottom'>"
		   end if
	    elseif tree="" then
		   if S_Isroot=1 then
              response.Write"<img src='../image/treeeo.GIF' align='absbottom'>"
		   else
              response.Write"<img src='../image/treeeo.GIF' align='absbottom'>"
		   end if
	    else
	       response.Write"<img src='../image/treeeo.GIF' align='absbottom'>"
	    end if
        
		response.Write NS_Name
		response.Write "<td width='32%'>"
		response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<a href='Sort_Edit.asp?id="&NS_Id&"&language="&language&"' title='"&NS_Name_C&"'>修改</a>"
        response.Write"&nbsp;| &nbsp;<a href='Sort_Add.asp?id="&NS_Id&"&language="&language&"' title='"&NS_Name_C&"'>添加下级分类</a>"
        response.Write"&nbsp;| &nbsp;<a href='Sort_Move.asp?action=up&id="&NS_Id&"&language="&language&"'><img src='../image/system/arrow_up.gif' border=0></a>&nbsp;&nbsp;<a href='Sort_Move.asp?action=down&id="&NS_Id&"&language="&language&"'><img src='../image/system/arrow_down.gif' border=0></a>"
        response.Write"&nbsp;| &nbsp;<a href='Sort_Del.asp?id="&NS_Id&"&language="&language&"' onClick=""return confirm('此操作不可恢复,确定执行吗?');"">删除</a>"
        response.Write"</td>"
        response.Write"</tr>"&vbcrlf
	    
		showtreeforline table,NS_Id,"rs"&cstr(NS_Id),treestr
		S_Isroot=1
     loop
  end if
  rs.close
end sub
sub showtree(table,sortid)
   response.Write"<table border='0' cellpadding='0' cellspacing='1' width='100%' class='border' bgcolor='#FFFFFF'>"
   showtreeforline table,sortid,"rs",""
   response.Write"</table>"
end sub

sub showtrees1(table,sortid,rs,tree)
if len(tree)=0 then
     S_Isroot=0
  end if
  trees="1"
  treestr=tree&trees
  set rs=server.CreateObject("adodb.recordset")
  rs.open"select * from "&table&" where "&prefix&"Parentid="&sortid&" order by "&prefix&"Order asc",conn,1,1
  if rs.eof and tree="" then
     response.Write"	 <tr class='tdbg'><td><center>暂无分类</center></td></tr>"
  else
     do while not rs.eof 
	    NS_Name=rs(prefix&"Name")
	    NS_Id=rs(prefix&"Id")
        rs.movenext
	    if rs.eof then
	       trees="0"
	       treestr=tree&trees
	    end if
%>
	 <tr class='tdbg'>
<TD vAlign=bottom width='5%'><%= NS_Id %></td> 
	</tr>
<%
end sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -