日期:2014-05-16 浏览次数:20362 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<script type="text/javascript">
function test(){
var xmlHttp=null;
if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}else if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var url="called.html";
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
alert(xmlHttp.responseText);
}
};
xmlHttp.open("GET",url,true);
xmlHttp.setRequestHeader("Content-Type", "application/text");
xmlHttp.setRequestHeader("Accept","application/text");
xmlHttp.send(null);
}
</script>
</head>
<body onload="test()">
</body>
</html>
result