The effects of the left navigation tree of MSDN and CSDN are that when you click the parent node, a request is sent to fill its subnodes! It seems that the webpage only refreshes parts! JavaScript + [asp + Access] source code download: www.triaton.com.cnPrivateZipTree.zip! -- Tree. asp --! DOCTYPEHTMLPUBLIC-W3CDTDHTML
The effects of the left navigation tree of MSDN and CSDN are that when you click the parent node, a request is sent to fill its subnodes! It seems that the webpage only refreshes parts! JavaScript + [asp + Access] realize source program download: http://www.triaton.com.cn/Private/Zip/Tree.zip! -- Tree. asp --! Doctype html public-// W3C // DTD HTML
MSDN and CSDNLeftNavigationTreeEffectWhen you click the parent node, send a request to fill in its child nodes! It seems that the webpage only refreshes parts! JavaScript + [asp + Access]Implementation
Source program download: http://www.triaton.com.cn/Private/Zip/Tree.zip
New Document
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> loading... <% I = I + 1 AdoRecordset. MoveNext Loop AdoRecordset. close Set adoRecordset = nothing AdoConnection. close Set adoConnection = nothing %> |
|
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 = 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 _
&
& Amp; 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
Table Structure:
Tree (id, parentid, remark)