87,910
社区成员
发帖
与我相关
我的任务
分享
<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