動態載入樹 (ASP+資料庫)

來源:互聯網
上載者:User
asp+|動態|資料|資料庫  

ASP+ACCESS 在資料量達100萬條記錄下,載入速度仍然驚人....

// 網上轉載. 忘了作者...  : )

//**********************  index.asp ************************//

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>tree</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
var d1,d2;

function expand(id)
{
 var d=new Date();
 d1=d.valueOf();

 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;
 }

 switch(dir_id.open)
 {
  //改變"+","-"
  case "true":
  {
   with(dir_id)
   {
    innerText = "+";
    open = "false";
    className = 'dirclose';
   }
   if(document.getElementById("t" + id))
   {
    eval("t"+id).style.display = 'none';
    document.getElementById("load_" + id).style.display = 'none';
    return;
   }
   else
   {
    document.getElementById("load_" + id).style.display = 'none';
   }
   break;
  }
  case "false":
  {
   with(dir_id)
   {
    innerText = "-";
    open = "true";
    className = 'diropen';
   }
   
   document.getElementById("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;
 }

}

function ArrToHtml(ArrNode,nodeid)
{
 //輸出到頁面
 var node_html = '<table id="t' + nodeid + '" width="100%" border="0" style="position: relative; left: 18px;" cellspacing="0" cellpadding="0">';

 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 id="node' + ArrNode[i].id + '" class="td_node" valign="top"><span class="' + cls + '" id="dir' + ArrNode[i].id + '" open="' + opened + '">' + str + '</span><span class="node" id="s' + ArrNode[i].id + '" title="' + ArrNode[i].Content + '" href="' + ArrNode[i].strLink + '">' + ArrNode[i].Content + '</span></td></tr>';

  if (ArrNode[i].iChildren > 0)
  {
   node_html += '<tr id="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="load">Loading...</span></td></tr></table></td></tr>';
  }
 }

 node_html += '</table>';
 if (document.getElementById("load_" + nodeid))
 {
  document.getElementById("load_" + nodeid).style.display = "none";
  document.getElementById("node" + nodeid).innerHTML += node_html;
  var d=new Date();
  d2=d.valueOf();
  message.innerHTML = "耗時:"+(d2-d1)+"ms";
 }
}
-->
</script>
</head>

<body topmargin="0" leftmargin="0" scroll="yes">



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.