Download Address:http://www.knowsky.com/download/treemenu.rar
Key code:
<%
Set Conn=server.createobject ("ADODB. CONNECTION ")
Connstr= "dbq=" +server.mappath ("Db1.mdb") + ";D efaultdir=;D river={microsoft Access DRIVER (*.mdb)};"
Conn.Open ConnStr
function menu (ID)
Set Rs=server. CreateObject ("Adodb.recordset")
Sql= ' select * from menu where id1= ' &id& ' ORDER by Url,id '
Rs.Open sql,conn,1,1
If Rs.recordcount=0 Then
Rs.close
Set rs=nothing
Exit function
End If
Response.Write ("<table border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 0 ' >")
I=1
While not rs.eof
If Len (rs ("url")) >0 Then
If I=rs.recordcount Then
Menutype= "File1"
Else
Menutype= "File"
End If
Menuname= "<a href= '" &rs ("url") & "' target= ' _blank ' >" &rs ("Menuname") & "</a>"
Onmouseup= ""
Else
If I=rs.recordcount Then
Menutype= "Menu3"
Listtype= "List1"
&RS ("id") & "')) if (style.display== ') {style.display= ' none '; this.classname= ' Menu3 ';} Else{style.display= '; this.classname= ' Menu4 ';}
Else
Menutype= "Menu1"
Listtype= "List"
&RS ("id") & "')) if (style.display== ') {style.display= ' none '; this.classname= ' menu1 ';} Else{style.display= '; this.classname= ' menu2 ';}
End If
Menuname=rs ("Menuname")
End If
%>
<tr>
<TD class= "<%= menutype%>" ><%= menuname%></td>
</tr>
<%if Len (rs ("url")) <3 then%>
<tr id= "id<%= RS (" id ")%>" style= "Display:none" >
<TD class= "<%= listtype%>" ><%menu (RS ("id")%></td>
</tr>
<%
End If
Rs.movenext
I=i+1
Wend
Response.Write ("</table>")
Rs.close
Set rs=nothing
End Function
%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title>========= infinite-level directory tree =========http://www.knowsky.com</title>
<style type= "Text/css" >
<!--
. menu1 {
Background-image:url (folder1.gif);
Background-repeat:no-repeat;
height:17px;
left:32px;
padding-left:32px;
Cursor:hand;
}
. menu2 {
Background-image:url (folder2.gif);
Background-repeat:no-repeat;
height:17px;
left:32px;
padding-left:32px;
Cursor:hand;
}
. menu3 {
Background-image:url (folder3.gif);
Background-repeat:no-repeat;
height:17px;
left:32px;
padding-left:32px;
Cursor:hand;
}
. menu4 {
Background-image:url (folder4.gif);
Background-repeat:no-repeat;
height:17px;
left:32px;
padding-left:32px;
Cursor:hand;
}
. list {
padding-left:20px;
Background-image:url (list.gif);
Background-repeat:repeat-y;
}
. list1 {
padding-left:20px;
}
. file {
Background-image:url (file.gif);
Background-repeat:no-repeat;
height:16px;
Cursor:hand;
padding-left:32px;
}
. file1 {
Background-image:url (file1.gif);
Background-repeat:no-repeat;
height:16px;
Cursor:hand;
padding-left:32px;
}
Body {
font-size:9pt;
Color: #000000;
Background-color: #FFFFFF;
}
a:link {
font-size:9pt;
Color: #000000;
Text-decoration:none;
}
a:visited {
font-size:9pt;
Color: #000000;
Text-decoration:none;
}
a:hover {
font-size:9pt;
Color: #0000FF;
Text-decoration:none;
position:relative;
right:1px;
bottom:1px;
}
a:active {
font-size:9pt;
Color: #000000;
Text-decoration:none;
}
-->
</style>
<body>
<a href= "http://www.knowsky.com/"Target=" _blank >http://www.knowsky.com/</a> offers the latest download "<a href=" menu.asp "> Management </a>" <br>
<%
Menu 0
Conn.close
Set conn=nothing
%>
</body>