有关树的问题(急的馒头大汉)

recentday 2003-10-02 10:14:44
我对于树有两个问题:
1、用javascript可以建立树,要不要生成一个类文件呢?是不是在需要树形结构的
jsp网页中就要重复的复制一份代码?
2、能不能给出一个用javascript、jdbc-odbc桥连接SQL2000、的程序代码!
希望各位高手能帮我解决这个问题:
数据库设计:
internalid parentid layer(零件处于第几级)
018 1001 1
019 1002 1
035 019 2

... ... ...

请问怎么写这个树呀?
谢谢各位高手了!
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
WalkSing 2003-10-07
  • 打赏
  • 举报
回复
call me.
walksing.ku.net 本服务器开机时间:(周一--周五) [8:40--18:30] .
recentday 2003-10-06
  • 打赏
  • 举报
回复
谁能回答此问题,我把全部家当相送!
recentday 2003-10-03
  • 打赏
  • 举报
回复
加44分凑个六六大顺,求完整的代码!
谢谢高手指点!救救我吧!
recentday 2003-10-03
  • 打赏
  • 举报
回复
我还是个大大的菜鸟,各位高手能帮我指点一下具体的程序吗?
gen2 2003-10-02
  • 打赏
  • 举报
回复
AddItem(id,leavel)你根据具体情况写啦,虽这个是Asp程序但实现的事都是一样....
gen2 2003-10-02
  • 打赏
  • 举报
回复
用深度遍历这颗数据库树
Function decomposeTree(fid,n)
dim strList
dim strIdList
dim zArr,zIdArr
if n>maxLeavel then Exit Function
strSQL="Select id,zitemid from work_bom where fitemid='" & fid & "'"
set rs=conn.Execute(strSQL)

if not rs.eof then
strList=strList & rs("zitemid")
strIdList=strIdList & rs("id")
rs.movenext
while not rs.eof
strList=strList & "," & rs("zitemid")
strIdList=strIdList & "," & rs("id")
rs.movenext
wend
rs.close
set rs=nothing

zArr=split(strList,",")
zIdArr=split(strIdList,",")
for i=0 to UBound(zArr)
call AddItem(zIdArr(i),n+1)
call decomposeTree(zArr(i),n+1)
next
else
rs.close
set rs=nothing
end if
End Function

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧