类似 MSDN 左边导航树效果的实现! [JavaScript + ASP] (转)

类似 MSDN 左边导航树效果的实现! [JavaScript + ASP] (转)[@more@]

MSDN 和CSDN 左边导航树的效果都是在点击父节点时,再发出请求填充其子节点!好像网页只刷新部分! Javascript + [ASP +  Access] 实现

程序下载: http://www.triaton.com.cn/Private/Zip/Tree.zip

<!-- Tree.asp --&gt
A href="tag-88-1.html">w3c//DTD HTML 4.0 Transitional//EN">


New Document


words" CONTENT="">







 

 

  dim adoConnection
  set adoConnection = Server.Createobject("ADOdb.Connection")
  'adoConnection.Open "Provider=sqlOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data source=TRIATONPSQL2KE"
  adoConnection.Open "Provider=microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("/dvbbs") & "Tree.mdb;Persist Security Info=False"
  dim adoRecordset
  set adoRecordset = Server.CreateObject("ADODB.Recordset")
  adoRecordset.Open "select *,(select count(*) from tree where parentid = T.id) as children from tree T where rootid = id ",adoConnection
  dim i
  i=0
  do until adoRecordset.eof
 %>


    正在加载 ...
 

  adoRecordset.MoveNext
  loop
  adoRecordset.close
  set adoRecordset = nothing
  adoConnection.close
  set adoConnection = nothing
%>
 

 

 



 

<!-- SubTree.asp --&gt



New Document






  dim parentid
  parentid = request.querystring("PID")
  parentnode = request.querystring("Parentnode")
  dim adoConnection
  set adoConnection = Server.CreateObject("ADODB.Connection")
'  adoConnection.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=TRIATONPSQL2KE"

  adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("/dvbbs") & "Tree.mdb;Persist Security Info=False"
  dim adoRecordset
  set adoRecordset = Server.CreateObject("ADODB.Recordset")
  adoRecordset.Open "select *,(select count(*) from tree where parentid =T.id ) as Children from tree T where parentid = " & parentid ,adoConnection
  response.write  adoRecordset.source
  dim i
  Dim SHTML
  dim parentnode
  parentnode = request.querystring("Pnode")
  dim j
  j= len(parentnode) - len(replace(parentnode,"_",""))
  dim nSpace
  for i=0 to j - 1
  nSpace = nSpace + "  "
  next
  i=0
  do until adoRecordset.eof
  shtml = shtml _
  & "

"
  if adoRecordset.Fields.item("Children").value >0 then
  shtml = shtml & "
" & nSpace & "  正在加载 ...
"
  end if
  i=i+1
  adoRecordset.MoveNext
  loop
  adoRecordset.close
  set adoRecordset = nothing
  adoConnection.close
  set adoConnection = nothing
'response.write shtml
%>


表结构:
Tree(id,parentid,remark)

 

 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-993773/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-993773/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值