Tutorials to .com

Tutorials to .com » Asp » Xml » XMLHTTP call asynchronous data

XMLHTTP call asynchronous data

Print View , by: iSee ,Total views: 7 ,Word Count: 589 ,Date: Wed, 22 Apr 2009 Time: 8:19 AM

<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "936"%>
<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--# include file = "conn.asp" ->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> http://asp2004.net </ title>
<link href="style.css" rel="stylesheet" type="text/css">
</ head>

<body onLoad="exe(0);">
<script language="javascript" src="function.js"> </ script>
<script language="javascript">
var isShow;
var isLoad;
isLoad = new ActiveXObject ( "Scripting.Dictionary");
/ / isShow = new ActiveXObject ( "Scripting.Dictionary");
function exe (id)
(
if (! isLoad.Exists (id))
(
isLoad.add (id ,'');
loaddata (id);
)
/ *
if (isShow.Exists (id))
(
isShow.Remove (id);
)
else
(
isShow.Add (id ,'');
)
* /
if (id> 0)
change1 ( 'a' + id, 'b' + id);
)
function loaddata (id)
(
eval ( 'c' + id). innerHTML = 'is loaded. . . ';
var xml = new ActiveXObject ( "Microsoft.XMLHTTP");
xml.open ( "GET", "server.asp? id =" + id, false);
xml.send ();
var returnvalue = unescape (xml.ResponseText);
var m = returnvalue.split ("#");
var str;
str = "<table border='0' cellspacing='0' cellpadding='0'>";
var i = 0, len = m.length-1;
for (; i <len; i + +)
(
var n = m [i]. split ("*");
if (n [0]> 0) / / there are child nodes
(
var listtype;
if (i == len-1) / / last one
(
str + = "<tr colspan='2' onClick=exe('" + n[1] + "');> <td id='b" + n[1] + "'class='menu3'>" + n [3] + "</ td> </ tr>";
listtype = "list1";
)
else
(
str + = "<tr colspan='2' onClick=exe('" + n[1] + "');> <td id='b" + n[1] + "'class='menu1'>" + n [3] + "</ td> </ tr>";
listtype = "list";
)
str + = "<tr id='a" + n[1] + "'style='display:none'> <td id = 'c" + n [1] + "' class = '" + listtype + " '> </ td> ";
)
else / / leaf node
(
if (i == len-1) / / last one
(
str + = "<tr> <td id='b" + n[1] + "'class='file1'> <a href='" + n[4] + "'target='_blank'>" + n [3] + "</ a> </ td> </ tr>";
)
else
(
str + = "<tr> <td id='b" + n[1] + "'class='file'> <a href='" + n[4] + "'target='_blank'>" + n [3] + "</ a> </ td> </ tr>";
)
)
)
str + = "</ table>";
eval ( 'c' + id). innerHTML = str;
)
</ script>
management <a href="menu.asp"> background </ a> asynchronous call: <br>
<div id="c0"> </ div>
</ body>
</ html>



Asp and XML related Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.