求xml加access的树型菜单

drzy 2004-04-08 02:01:28
不是xml的也可以,要无限分类的
谢了!
...全文
25 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
drzy 2004-04-08
这个可以,但有一个缺点,刷新后有的节点是打开的,谁能看看是怎么回师
Access数据库
● 数据库名:tree
● 表名:tree
● 字段名的设计
ID 文本类型 编码
Name 文本类型 节点文字
HyperLink 文本类型 相关信息
---------------------------------------------------
ID | Name | HyperLink
---------------------------------------------------
1_1_1 | ASP | http://www.csdn.net
---------------------------------------------------
1_1_1_1 | DHTML | http://www.csdn.net
---------------------------------------------------
1_2_2 | JAVA | http://www.csdn.net
---------------------------------------------------
1_1_2 | JavaScript | http://www.csdn.net
---------------------------------------------------
1_2_1 | VB | http://www.csdn.net
---------------------------------------------------
1_2_1_2 | VBA | http://www.csdn.net
---------------------------------------------------
1_1 | WEB开发 | http://www.csdn.net
---------------------------------------------------
1 | WWW.CSDN.net | http://www.csdn.net
---------------------------------------------------
1_2_1_1 | 基础类 | http://www.csdn.net
---------------------------------------------------
1_3_1 | 基础类 | http://www.csdn.net
---------------------------------------------------
1_2 | 开发语言 | http://www.csdn.net
---------------------------------------------------
1_1_1_2 | 内建对象 | http://www.csdn.net
---------------------------------------------------
1_3 | 数据库 | http://www.csdn.net
----------------------------------------------------
文件:nolimited.asp经简单测试好用!代码如下:
<html>
<head>
<META name=VI60_defaultClientScript content=VBScript>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>asp树的研究</title>
</head>
<style type="text/css">
<!--
.aa {
font-size: 14px;
color: #000000;
text-align: center;
vertical-align: middle;
letter-spacing: 0px;
word-spacing: 0px;
}
-->
</style>
<body bgcolor="DEE3F7">
<%
dim cn,rs,SQL ,Para,NumChild
set cn=server.CreateObject("ADODB.connection")
set rs=server.createobject("ADODB.recordset")
set rs1=server.createobject("ADODB.recordset")
cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tree.mdb")
SQL="Select * from tree order by ID"
rs.open SQL,cn,3,2
do while not rs.EOF
SQL="Select ID from tree where ID like '" & rs("ID") & "%' and ID<>'" & rs("ID") & "' order by ID"
Para=rs("ID") & "|"
NumChild=0
rs1.open SQL,cn, 3,2
NumChild=rs1.RecordCount
do while not rs1.EOF
Para =Para & rs1("ID") & "|"
rs1.MoveNext
loop
Para=cstr(trim(left(Para,len(Para)-1)))
rs1.Close
%>
<table id="T<%=rs("ID")%>"
border=1
cellpadding=0
cellspacing=0
bordercolor="#DEE3F7"
class="aa"
abbr="<%=Para%>"
summary=<%=checkid(rs("ID"))%>
style="cursor:hand"
onClick="vbs:subtree '<%=Para%>'" >

<tr>
<td width="<%=17+checkid(rs("ID"))*20%>"
height="20" align="right">
<table width="20" height="20" border="1" cellpadding="0" cellspacing="0" bordercolor="#DEE3F7">
<tr>

<td align="center" valign="middle" bordercolor="#000000" id="R<%=rs("ID")%>" ><%if NumChild=0 then Response.Write "." else Response.Write "-"%></td>
</tr>
</table>
</td>

<td height="20"
nowrap
bordercolor="#FFFFFF"
onMouseOver="vbs:me.bgcolor='#CCCCCC':me.bordercolor='#999999'"
onMouseOut="vbs:me.bgcolor='#DEE3F7':me.bordercolor='#ffffff'"
title="<%=rs("HyperLink")%>">
<%=rs("Name")%></td>
</tr>
</table>


<%
rs.MoveNext
loop
rs.Close:set rs=nothing
cn.Close:set cn=nothing
function checkid(x)
dim Tempnum
Tempnum=0
for i=1 to len(x)
if mid(x,i,1)="_" then
Tempnum=Tempnum+1
end if
next
checkid=Tempnum
end function


%>
<script language=VBS>
sub subtree(Client_para)
if instr(Client_para,"|")=0 then exit sub
Myarray=split(Client_para,"|")
Mytext=eval("R" & Myarray(0) & ".innertext")
select case Mytext
case "+"
document.all.item("R" & Myarray(0)).innertext="-"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")=1 then
document.all.item("T" & Myarray(i)).style.display="block"
end if
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>1 then
document.all.item("T" & Myarray(i)).style.display="none"
end if
next
case "-"
document.all.item("R" & Myarray(0)).innertext="+"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>=1 then
document.all.item("T" & Myarray(i)).style.display="none"
if eval("R" & Myarray(i) & ".innertext")="-" then
document.all.item("R" & Myarray(i)).innertext="+"
end if
end if
next
end select
set Myarray=nothing
end sub

Sub document_onselectstart
document.selection.clear
End Sub

if isobject(eval("T1")) then
subtree document.all("T1").abbr
subtree document.all("T1").abbr
end if
</script>

</html>
回复
drzy 2004-04-08
id name belong_id(上级id) index_id(顶级id)
这样的表结构递归时的recordset对象怎么处理
sub tree()
sql ="....."
rs.open sql,conn,1,1
while not rs.eof
'''''''
call tree()
wend
''''
end sub
程序大概就是这个样子,循环时rs不能close怎么办
回复
nameldw 2004-04-08
http://fason.nease.net/
回复
drzy 2004-04-08
有没有不是xml的?我不懂xml
谢了?
回复
fason 2004-04-08
添加修改最简单的,删除可以用SP
回复
drzy 2004-04-08
http://www.pusc.cn/wmh/sites.rar
好象是阿信的
怎么添加,修改,删除分类呀
回复
孟子E章 2004-04-08
http://dotnet.aspx.cc/exam/t.zip
回复
孟子E章 2004-04-08
http://dotnet.aspx.cc/exam/t.zip
回复
孟子E章 2004-04-08
http://xml.sz.luohuedu.net/xml/tree

http://xml.sz.luohuedu.net/xml/tree
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告