Dynamic load tree (asp+ database)

Source: Internet
Author: User
Tags eval relative
Asp+| News | data | database

Asp+access in the data volume of 1 million records, loading speed is still staggering ....

Reproduced online. Forget the author ...:)

Index.asp ************************//

<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%option explicit%>
<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)
{
Change "+", "-"
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)
{
Output to Page
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 "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 = "Time Consuming:" + (D2-D1) + "MS";
}
}
-->
</script>

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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.