asp动态树菜单集合(3/3)

<!--三级树,同时展开多个子菜单的-->

 

数据库结构详见

 http://blog.csdn.net/piperzero/archive/2006/07/25/977083.aspx


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Inc/conn.asp" -->
<%
Dim C01
Dim C01_numRows

Set C01 = Server.CreateObject("ADODB.Recordset")
sql1 = "SELECT * FROM bigclass"
c01.open sql1,conn,1,1

C01_numRows = 0
%>
<%
Dim C2
Dim C2_numRows

Set C2 = Server.CreateObject("ADODB.Recordset")
sql2 = "SELECT * FROM smallclass"
c2.open sql2,conn,1,1

C2_numRows = 0
%>
<%
Dim C3
Dim C3_numRows

Set C3 = Server.CreateObject("ADODB.Recordset")
sql3 = "SELECT * FROM minclass"
c3.open sql3,conn,1,1

C3_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
C01_numRows = C01_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script>// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
 
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++)
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
 
  return foundObj;
}
</script>
<style type="text/css">
<!--
.folder {
 font-family: "Verdana", "Arial", "Helvetica", "sans-serif";
 font-size: 12px;
 background-image: url(e.gif);
 background-repeat: no-repeat;
 background-position: left;
 padding-left: 40px;
 cursor: hand;
}
.collapsedFolder {
 font-family: "Verdana", "Arial", "Helvetica", "sans-serif";
 font-size: 12px;
 background-image: url(c.gif);
 background-repeat: no-repeat;
 background-position: left;
 padding-left: 40px;
 cursor: hand;
}
.submenu {
 padding-left: 18px;
}
.iefile {
 background-image: url(ie.gif);
 background-repeat: no-repeat;
 background-position: left;
 padding-left: 20px;
 font-family: "Verdana", "Arial", "Helvetica", "sans-serif";
 font-size: 12px;
}
a {
 color: #003399;
 text-decoration: none;
 border: 1px solid #FFFFFF;
}
a:hover {
 color: #FF0000;
 background-color: #eeeeee;
 border: 1px solid #006699;
}
body {
 margin: 0px;
 background-color: buttonface;
 overflow: hidden;
 border: 0px;
}
.ctrlbar {
 border: 1px inset;
}
.explorer {
 background-color: #FFFFFF;
 border: 1px inset;
}
-->
</style>
<style type="text/css">
<!--
.ctbutton {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 8px;
 background-color: #eeeeee;
 border-width: 1px;
 width: 9px;
 height: 100px;
 margin-bottom: 100px;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="2" onselectstart="return false">
  <%
While ((Repeat1__numRows <> 0) AND (NOT C01.EOF))
%>
  <tr>
    <td class="collapsedFolder" onmouseup="with(findObj('C01<%=(C01.Fields.Item("bigclassid").Value)%>').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(e.gif)':'url(c.gif)'}"><%=(C01.Fields.Item("bigclassname").Value)%></td>
  </tr>
  <tr>
    <td class="submenu" id="C01<%=(C01.Fields.Item("bigclassid").Value)%>" style="display:none">
<%
FilterParam=(C01.Fields.Item("bigclassid").Value)
C2.Filter="bigclassid="&FilterParam
While (NOT C2.EOF)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<%
smallclassname=c2("smallclassname")
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from minclass where smallclassname='"&smallclassname&"'"
rs.open sql,conn,1,1%>
        <tr>
          <td class="collapsedFolder" onmouseup="with(findObj('D01<%=(C2.Fields.Item("smallclassid").Value)%>').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(e.gif)':'url(c.gif)'}"><%if rs.recordcount=0 then %>
    <a href="product.asp?bigclassname=<%=c01("bigclassname")%>&smallclassname=<%=c2("smallclassname")%>"><%=(C2.Fields.Item("smallclassname").Value)%></a><%else%><%=(C2.Fields.Item("smallclassname").Value)%><%end if%></td>
        </tr>
        <tr>
          <td class="submenu" id="D01<%=(C2.Fields.Item("smallclassid").Value)%>" style="display:none"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<%
FilterParam=(C2.Fields.Item("smallclassid").Value)
C3.Filter="smallclassid="&FilterParam
While (NOT C3.EOF)
%>
              <tr>
                <td class="iefile"><a href="product.asp?bigclassname=<%=c01("bigclassname")%>&smallclassname=<%=c2("smallclassname")%>&minclassname=<%=c3("minclassname")%>"><%=(C3.Fields.Item("minclassname").Value)%></a></td>
              </tr>
<%
C3.MoveNext()
Wend
%>
          </table></td>
        </tr>
    </table>
<%
C2.MoveNext()
Wend
%>
 </td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  C01.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
C3.Close()
Set C3 = Nothing
%>
<%
C2.Close()
Set C2 = Nothing
%>
<%
C01.Close()
Set C01 = Nothing
%> 

你可能感兴趣的:(asp)