類似MSDN左邊導(dǎo)航樹(shù)效果的實(shí)現(xiàn)![JavaScript+ASP](轉(zhuǎn))

類似 MSDN 左邊導(dǎo)航樹(shù)效果的實(shí)現(xiàn)! [JavaScript + ASP] (轉(zhuǎn))[@more@]

MSDN 和CSDN 左邊導(dǎo)航樹(shù)的效果都是在點(diǎn)擊父節(jié)點(diǎn)時(shí),再發(fā)出請(qǐng)求填充其子節(jié)點(diǎn)!好像網(wǎng)頁(yè)只刷新部分! Javascript + [ASP +  Access] 實(shí)現(xiàn)

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

<!-- Tree.asp -->



New Document










 
 
 

 

 
 
 
 
 

<%
  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
 %>

  <%  if adoRecordset.Fields.item("Children").value >0 then %>
  onClick='ExpandNode(Node_<% = i %>,<% =adoRecordset.Fields.item("id").value%>)'>+
  <% else %>
  >-
  <% end if%>
,<% =adoRecordset.Fields.item("id").value%>)'><% =adoRecordset.Fields.item("remark").value%>


<%  i=i+1
  adoRecordset.MoveNext
  loop
  adoRecordset.close
  set adoRecordset = nothing
  adoConnection.close
  set adoConnection = nothing
%>
 

 

 



創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都做網(wǎng)站、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的恩平網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

<!-- SubTree.asp -->



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 _
  & "

" & nSpace _
  & "  if adoRecordset.Fields.item("Children").value >0 then
  shtml = shtml & " onClick='ExpandNode(" & parentnode & "_" & i + 1 & "," & adoRecordset.Fields.item("id").value & ")'>+"
  else
  shtml = shtml & ">-"
  end if
  shtml = shtml & "n" & "  if adoRecordset.Fields.item("Children").value >0 then
  shtml = shtml & "onDblClick='ExpandNode(" & parentnode & "_" & i + 1 & "," & adoRecordset.Fields.item("id").value & ")'"
  end if
  shtml = shtml & ">" & adoRecordset.Fields.item("id").value & ": " &  adoRecordset.Fields.item("remark").value & "
"
  if adoRecordset.Fields.item("Children").value >0 then
  shtml = shtml & ""
  end if
  i=i+1
  adoRecordset.MoveNext
  loop
  adoRecordset.close
  set adoRecordset = nothing
  adoConnection.close
  set adoConnection = nothing
'response.write shtml
%>


表結(jié)構(gòu):
Tree(id,parentid,remark)


網(wǎng)頁(yè)題目:類似MSDN左邊導(dǎo)航樹(shù)效果的實(shí)現(xiàn)![JavaScript+ASP](轉(zhuǎn))
本文URL:http://bm7419.com/article26/gijecg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、全網(wǎng)營(yíng)銷推廣、網(wǎng)站建設(shè)、網(wǎng)站策劃、小程序開(kāi)發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)