62,074
社区成员
发帖
与我相关
我的任务
分享
<head>
<script type="text/javascript" src="myscript.js"></script>
</head>
<script>
var xmlHttp;
window.onload=function(){
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
//IE7 8
// xhr = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "Handler.ashx"; //请求url
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ShowResult;
xmlHttp.send(null);
}
function ShowResult() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var s;
s = xmlHttp.responseText; alert(s);
document.write(s);//输出到页面上
}
}
}
</script>