Dynamic load tree (ASP + database)

xiaoxiao2021-03-05  23

ASP Access is recorded in the amount of 1 million data volume, and the load speed is still amazing ...

// Reprinted online. Forgot the author ...:)

// ************************************************************* * //

<% @ Language = "Vbscript" CODEPAGE = "936"%> <% option explicit%> Tree </ title> <link href = "css / style.css" rel = "stylesheet" type = "text / css"> <script language = "javascript"> <! - var D1, d2;</p> <p>Function Expand (ID) {var D = New Date (); D1 = D.Valueof ();</p> <p>VAR S_ID = EVAL ("S" ID); var Dir_ID = EVAL ("DIR" ID); if (s_id.href! = ') {//window.open (S_ID.href); // OR / /top.frames['framename'].location.href = s_id.href;}</p> <p>Switch (Dir_id.open) {// Changes " ", "-" Case "true": {with (Dir_ID) {innerText = " "; open = "false"; classname = 'Dirclose';}}} .GETELEMENTBYID ("T" ID)) {EVAL ("t" id) .style.display = 'none'; document.getlementByid ("LOAD_" ID) .Style.Display = 'None'; return;} Else {document.getlementByid ("LOAD_" ID) .style.display = 'none';} Break;} Case "false": {with (Dir_id) {innerText = "-"; open = "true"; classname = 'Diropen';} Document.GtelementByid ("LOAD_" ID) .Style.Display = ''; if (Document.getElementById ("t" id)) {EVAL ("t" id) .style.display = '; EVAL ("LOAD_" ID) .style.display =' none '; return;} else {document.frames [' hifm ']. Location.replace ("Subtree.asp? Id =" id); } Break;} default: Dir_id.innertext = "; DIR_ID.CLASSNAME = 'DIRNODE'; RETURN;}}}</p> <p>Function Arrtohtml (arrnode, nodeid) {// output to page var node_html = '<table id = "t' nodeid '" width = "100%" border = "0" style = "Position: relative; Left: 18px "" Cellspacing = "0" cellpadding = "0"> ';</p> <p>Var Str, Opened, CLS for (VAR i = 0; I <arrnode.length; i ) {IF (arrnode [i] .ichildren == 0) {str = '.'; OPENED = 'NO'; CLS = ' DirNode ';} else {str =' '; OPENED =' false '; CLS =' Dirclose ';} node_html =' <tr> <td = "node ' arrnode [i] .id '" Class = "TD_NODE" VALIGN = "TOP"> <span class = "' CLS '" ID = "Dir ' ArrNode [i] .id '" οnclick = "expand (' arrnode [i] .id ') "Open ="' Opened '">' STR '</ span> <span class =" node "id =" arrnode [i] .id ' "οnclick =" expand (' Arrnode [i] .id ') "Title =" arrnode [i] .content ' "href =" ' arrnode [i] .strlink ' "> arrnode [i] .content ' </ span> </ td> </ tr> ';</p> <p>IF (arrnode [i] .ichildren> 0) {node_html = '<triple = "LOAD_' ArrNode [i] .id '" style = "display: none"> <td class = "td_node"> < Table border = "0" cellspacing = "0" cellpadding = "0" style = "Position: relative; left: 18; top: 0px"> <tr> <td class = "td_node"> <span class = "dirnode" >. </ span> <span class = "loading"> loading ... </ span> </ td> </ tr> </ table> </ td> </ tr> ';}}</p> <p>Node_html = '</ table>'; if ("load_" nodeid) {document.getElementByid ("LOAD_" NodeID) .style.display = "none"; document.getlementByid ("Node" nodeid) .innerhtml = node_html; var d = new date (); d2 = d.Valueof (); message.innerhtml = "time:" (D2-D1) "MS";}} -> </ script> </ head> <body topmargin = "0" leftmargin = "0" scroll = "yes"> <% DIM CONN, RSDIM S, Open, Clson Error Resume Next Cn = Server.createObject ("AdoDb.Connection ") conn.open" provider = microsoft.jet.Oledb.4.0; data source = "& server.mappath (" Tree / Tree.mdb ") &"; persist security info = false "set = Server.createObject (" AdoDb.recordset ")</p> <p>rs.open "SELECT *, (Select Count (*) from DeepTree WHERE PARENTID = T.ID) AS Children from DeepTree T Where Parentid = 0 Order By ParentID", CONN, 1, 3%> <Div ID = "Message" Style = "Height: 20px" align = "center"> </ div> <div align = "center"> <center> <table border = "0" width = "100%" cellspacing = "0" cellpadding = "0 "Height =" 100% "BGColor =" # f2f2f2 "> <tr> <td width =" 260 "Valign =" TOP "align =" left "> <div id =" Treedir "style =" overflow: auto; width : 30%; Height: 100%; "> <table border =" 0 "cellspacing =" 0 "cellpadding =" 0 "style =" position: relative; Left: 18px; Top: 20px; "Width =" 100% " > <% Do while not rs.eof if = 0 THEN S = "." Open = "no" CLS = "DirNode" else s = " " open = "false" CLS = "Dirclose" END IF%> <tr> <TD ID = "Node <% = rs (" ID ")%>" class = "td_node" Valign = "TOP"> <span class = "<% = CLS%>" ID = "DIR <% = rs (" ID ")%>" οnclick = "expand (<% = rs (" ID ")%>" open = "<% = open%>> <% = s%> < / span> <span class = "Node" ID = "s < % = rs ("ID")%> "οnclick =" expand (<% = rs ("ID")%>) "Title =" <</p> <p>% = TRIM (RS ("Content"))%> "HREF =" <% = Trim (RS ("LINK")%>>> <% = rs ("content")%> </ span> </ TD> </ TR> <% IF RS ("Children")> 0 THEN%> <trid = "LOAD _ <% = rs (" ID ")%>" Style = "Display: None> <TD Class = "td_node"> <table border = 0 "cellspacing =" 0 "cellpadding =" 0 "style =" Position: Relative; Left: 18; Top: 0 "width =" 100% "> <TR> <TD class = "TD_NODE"> <span class = "dirnode">. </ span> <span class = "loading"> loading ... </ span> </ td> </ tr> </ table> </ td> < / TR> <% end if%> <% rs.movenext loop%> </ table> </ div> </ td> </ table> </ center> </ div> <% set = Nothingset conn = Nothing %> <iframe id = 'hifm' width = 0 height = 0 style = "display: none" height = "100%" width = "100%"> </ iframe> </ body> </ html> ////// ***************** Subtree.asp ******************** //</p> <p><% Option Explicit%> <script language = "javascript"> Function NodeClass (ID, content, strlink, ichildren) {//this.id=parseint(ID); this.id = id; this.content = content; this. .strlink = strlink; this.ichildren = Ichildren; //this.ichildren=parseint(ILDREN);</p> <p>Var arrnode = new array (); <% DIM CONN, RS, S, CLS, HREF, OPENDIM NODEID, INODEID = Request.QueryString ("ID") 'On Error Resume NextSet Conn = Server.createObject ("AdoDb.Connection" ) conn.d "provider = microsoft.jet.Oledb.4.0; data source =" & Server.mappath ("Tree / Tree.mdb") & "; persist security info = false" set = server.createObject ("AdoDB .Recordset ") rs.open" SELECT *, (Select Count (*) from DeepTree WHERE PARENTID = T.ID) AS Children from DeepTree T Where Parentid = "& Nodeid &" ", CONN, 1,3i = 0do while not rs.eof%> Arrnode [<% = I%>] = new nodeClass (<% = rs ("ID")%>, '<% = trim (RS ("Content"))%>,' <% = TRIM ("LINK"))%> ', <% = rs ("Children")%>); <% i = i 1 rs.movenextLoop</p> <p>SET RS = Nothing%> Parent.arrtohtml (Arrnode, '<% = nodeId%>); -> </ script> <% set conn = Nothing%></p> <p>// ******************************************************** //</p> <p><Public: Component> <public: attach evenet = "/> <public: attach evenet =" /> <public: attach event = "on" /> <public: attach evenet = "overselectstart" Onevent = "ST ()" /> <script> function fos () {if (style.backroundcolor! = '# Fffff') {style.color = "# 000000" style.border = "1 Solid # 888888" style. BackgroundColor = '# dddddd'} else {style.color = "# 000000" Style.Border = "1 Solid # 999999" style.backgroundcolor = '# ffffff'}}</p> <p>Function Blu () {if (Style.BackgroundColor! = '# fffff') {style.color = "# 000000" Style.Border = "1 Solid # f2f2f2" style.backgroundcolor = '# f2f2f2'} else {style.color = "# 000000" Style.Border = "1 Solid # 999999" Style.BackgroundColor = '# ffffff'}} function st () {returnaf false;} </ script> </ public: company</p> <p>// ***********************************************************</p> <p>Body {font-size: 12px} # {font-size: 12px; color: # 000000; Font-Family: Courier New; Border: 1 Solid # 3366cc} #hrf {font-size: 12px; color: # 000000; FONT-FAMILY: COUR NEW; Border: 1 Solid # 3366cc} #sb {font-size: 12px; color: # 000000; font-family: Courier New; Background-Color: # D2E8FF; Border: 1 Solid # 3366cc; cursor : Hand} .Node {POSITION: Relative; Left: 2; Height: 20; Padding: 3 3 1 3; Font-size: 12px; font-family: Courier New; Cursor: hand; border: 1 Solid # f2f2f2; behavior : URL (CSS / Node.htc)}. Load {Position: Relative; Left: 2; Height: 20; Padding: 1 3 1 3; Font-Size: 12px; Font-Family: Courier New; Cursor: Hand; Border : 1 Solid # 999999; Background-Color: # f2f2f2; color: # 999999} .td_node {} span.diropen {} span.diropen {padding-left: 2px; overflow: hidden; line-height: 3px; font -Size: 12px; Padding-top: 5px; Width: 11px; Height: 11px; Border: Solid 1px Black; Background-Color: #ffffff; Cursor: Hand;} span.dirclose {line-height: 6px; font-size : 9px; overflow: hidden; padding: 2px; width: 11px; height: 11px; border: solid 1px black; backgroun D-color: #fffffff; cursor: hand;}. DirNode {font-weight: bold overflow: visible; font-size: 9px; line-height: 3px; padding: 1px 1px 0px 3px; width: 11px; height: 11px Border: Solid 1PX Black; Background-Color: #ffffff; CURSOR: HAND;</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-34798.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="34798" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.033</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '69pbRVQgpAMEpxrCXgqXXXvBRuaNh7C6QZKQxCcKjNuchgPn4NpZ0ADZi_2ByW1s4Po75rOFqCXcfCyxzlsMVNmg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>