HTML>HEAD>TITLE>Ajax test/TITLE>
META http-equiv=Content-Type content="text/html; charset=gb2312">
SCRIPT src="Ajax test_files/utl.js">/SCRIPT>
LINK rev=stylesheet media=all href="Ajax test_files/Ajax.css" type=text/css
rel=stylesheet>
SCRIPT>
//------------ XMLHttpObj类 ----------------
function XMLHttpObject(url,Syne){
var XMLHttp=null
var o=this
this.url=url
this.Syne=Syne
this.sendData = function()
{
if (window.XMLHttpRequest) {
XMLHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
with(XMLHttp){
open("GET", this.url, this.Syne);
onreadystatechange = o.CallBack;
send(null);
}
}
this.CallBack=function()
{
if (XMLHttp.readyState == 4) {
if (XMLHttp.status == 200) {
o.debugXML("readyState:" + XMLHttp.readyState + "br/>")
o.debugXML("status :" + XMLHttp.status + "br/>")
o.debugXML(" div style='background:#ffc;margin-left:10px;border:1px solid #669;padding:3px'>" + createXmlTree(XMLHttp.responseXML,0) + "/div>")
}
}
}
this.getText=function()
{
if (XMLHttp==null) {return "还没加载 XMLHttpRequest"}
if (XMLHttp.readyState==4) {return XMLHttp.responseText}
return XMLHttp.readyState
}
this.debugXML=function(log)
{
try{document.getElementById("XMLDebug").innerHTML+=log}
catch(e){}
}
}
var XMLDoc1=new XMLHttpObject("tree.xml",true)
/SCRIPT>
META content="MSHTML 6.00.3790.2706" name=GENERATOR>/HEAD>
BODY>SELECT
onchange='XMLDoc1.url=this.value;document.getElementById("XMLDebug").innerHTML=""'>
OPTION value=tree.xml selected>tree.xml/OPTION> OPTION
value=xtree.xsl>xtree.xsl/OPTION> OPTION value=/feed.asp>Blog
Feed/OPTION>/SELECT> INPUT onclick=XMLDoc1.sendData() type=button value=XMLDoc1.sendData()> INPUT onclick=alert(XMLDoc1.getText()) type=button value=XMLDoc1.getText()> INPUT onclick="if (confirm('clear log?')) {document.getElementById('XMLDebug').innerHTML=''}" type=button value=ClearLog>
DIV id=XMLDebug>/DIV>/BODY>/HTML>