• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

类似 MSDN CSDN 左边导航树效果的实现! [&#106avascript + ASP]

mysql 搞代码 4年前 (2022-01-09) 17次浏览 已收录 0个评论

MSDN 和CSD本文来源gaodai#ma#com搞*代#码9网#N 左边 导航 树的 效果 都是在点击父节点时,再发出请求填充其子节点!好像网页只刷新部分! JavaScript+ [asp + Access] 实现 源程序下载: http://www.triaton.com.cn/Private/Zip/Tree.zip !– Tree.asp — !DOCTYPE HTML PUBLIC -//W3C//DTD HTML

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

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

New Document
<meta NAME=Generator CONTENT=EditPlus>
<meta NAME=Author CONTENT=>
<meta NAME=Keywords CONTENT=>
<meta NAME=Description CONTENT=>

<body>
<iframe width=100% height=30 id=hiddenframe></iframe>
<script>
function ExpandNode(ParentNode,ParentId){
var NodeX = eval(ParentNode.id + _0);
if (NodeX.style.display == none)
  {
  NodeX.style.display=block;
  if (NodeX.loaded == no)
    {
    document.frames[hiddenframe].location.replace(http://localhost/dvbbs/subtree.asp?PID= + ParentId + &PNode= + ParentNode.id);
    NodeX.loaded = yes;
   }
  }
else
  {
  NodeX.style.display=none;
  }
}
</script>


 
  
 

    
     
       
         
       
     

<%
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=TRIATON\PSQL2KE
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%>

_0 >    正在加载 …
  

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


    

  

New Document
<meta NAME=Generator CONTENT=EditPlus>
<meta NAME=Author CONTENT=>
<meta NAME=Keywords CONTENT=>
<meta NAME=Description CONTENT=>

<body>
<%
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=TRIATON\PSQL2KE

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
%>
<script>
  var x = eval(parent. + <% =request.querystring(Pnode) & _0%> ) ;
  x.innerHTML=<% =shtml %>;
</script>

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


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:类似 MSDN CSDN 左边导航树效果的实现! [&#106avascript + ASP]

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址