<script type="text/javascript"> var xmlhttp; var turl="http://marvel.hit.edu.cn:8080/weblogs/2004_8_22.xml"; loadXMLDoc(turl); function loadXMLDoc(url) { try{ // code for Mozilla, etc. if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); //xmlhttp.onreadystatechange=xmlhttpChange; alert(xmlhttp.send ); // xmlhttp.open("GET",url,true); xmlhttp.send(null); } // code for IE else if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (xmlhttp) { xmlhttp.onreadystatechange=xmlhttpChange; xmlhttp.open("GET",url,true); xmlhttp.send(); } } } catch(e) {alert(e.Message);} }function xmlhttpChange() { // if xmlhttp shows "loaded" /*if (xmlhttp.readyState==4) { // if "OK" if (xmlhttp.status==200) { // ...some code here... alert("OK"+xmlhttp.responseText); } else { alert("Problem retrieving XML data"); } }*/ } </script>
//url为需要打开的xml文件地址 //onready为在加载完成后需要执行的命今 function xmlhttp_async(url,onready){ if ( url==null || url=="" ) return false; if ( window.ActiveXObject && !window.XMLHttpRequest ) x = new ActiveXObject( "Microsoft.XMLHTTP" ); // IE else x = new XMLHttpRequest(); // Mozilla, Opera x.open("GET",url,true); x.send(); if(onready!=""){ x.onreadystatechange =function() { //304 for Opera if ( x.readyState==4 && (x.status==200||x.status==304) ){ eval(onready); } } } }
var xmlhttp;
var turl="http://marvel.hit.edu.cn:8080/weblogs/2004_8_22.xml";
loadXMLDoc(turl);
function loadXMLDoc(url)
{
try{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
//xmlhttp.onreadystatechange=xmlhttpChange;
alert(xmlhttp.send );
// xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp)
{
xmlhttp.onreadystatechange=xmlhttpChange;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
}
}
catch(e)
{alert(e.Message);}
}function xmlhttpChange()
{
// if xmlhttp shows "loaded"
/*if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
// ...some code here...
alert("OK"+xmlhttp.responseText);
}
else
{
alert("Problem retrieving XML data");
}
}*/
}
</script>
//onready为在加载完成后需要执行的命今
function xmlhttp_async(url,onready){
if ( url==null || url=="" ) return false;
if ( window.ActiveXObject && !window.XMLHttpRequest )
x = new ActiveXObject( "Microsoft.XMLHTTP" ); // IE
else
x = new XMLHttpRequest(); // Mozilla, Opera
x.open("GET",url,true);
x.send();
if(onready!=""){
x.onreadystatechange =function() {
//304 for Opera
if ( x.readyState==4 && (x.status==200||x.status==304) ){
eval(onready);
}
}
} }