日期:2014-05-17  浏览次数:21340 次

各位大侠,帮帮忙,二级菜单生成双列
Function Folder(id)
  Dim rs, sql, i, ChildCount, FolderType, FolderName, onMouseUp, ListType
  Set rs = server.CreateObject("adodb.recordset")
  sql = "Select * From Qianbo_ProductSort where ParentID="&id&" order by id"
  rs.Open sql, conn, 1, 1
  If id = 0 And rs.recordcount = 0 Then
  response.Write ("<center>暂无产品分类</center>")
  Exit Function
  End If
  i = 1
  response.Write("<table border=""0"" cellspacing=""0"" cellpadding=""0"">")
  While Not rs.EOF
  ChildCount = conn.Execute("select count(*) from Qianbo_ProductSort where ParentID="&rs("id"))(0)
  If ChildCount = 0 Then
  If i = rs.recordcount Then
  FolderType = "SortFileEnd"
  Else
  FolderType = "SortFile"
  End If
  FolderName = rs("SortName")
  onMouseUp = ""
  Else
  If i = rs.recordcount Then
  FolderType = "SortEndFolderClose"
  ListType = "SortEndListline"
  onMouseUp = "EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
  Else
  FolderType = "SortFolderClose"
  ListType = "SortListline"
  onMouseUp = "SortChange('a"&rs("id")&"','b"&rs("id")&"');"
  End If
  FolderName = rs("SortName")
  End If
  datafrom = "Qianbo_ProductSort"
  If ISHTML = 1 Then
  AutoLink = ""&ProSortName&""&Separated&""&rs("ID")&""&Separated&"1."&HTMLName&""
  Else
  AutoLink = "ProductList.Asp?SortID="&rs("ID")&""
  End If
  response.Write "<tr height=""23"" >"
  response.Write("<td nowrap id=""b"&rs("id")&""" class="""&FolderType&"""></td><td nowrap style=""padding-top: 2px""><a href="""&AutoLink&""">"&FolderName&"</a></td></tr>")
  If ChildCount>0 Then
%>
<tr id="a<%= rs("id")%>" style="display:yes">
  <td class="<%= ListType%>" nowrap></td>
  <td><% Folder(rs("id")) %></td>
</tr>
<%
End If
rs.movenext
i = i + 1
Wend
response.Write("</table>")
rs.Close
Set rs = Nothing
End Function


最后生成的代码:
<table cellspacing="0" cellpadding="0" border="0"><tbody>
  <tr height="23">
  <td nowrap="" class="SortFolderClose" id="b1"></td>
  <td nowrap="" style="padding-top: 2px"><a href="ProductClass_1_1.html">产品世界</a></td> //一级菜单