日期:2014-05-16 浏览次数:20524 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Simple?XMLHttpRequest</title>
<script ?type="text/javascript">
var?xmlHttp;?
function?createXMLHttpRequest()?{????
if?(window.ActiveXObject)?{
???????? xmlHttp?=?new?ActiveXObject("Microsoft.XMLHTTP");??
??}
???? else?if?(window.XMLHttpRequest)?{???
???? xmlHttp?=?new?XMLHttpRequest();??
??}
}?
function?handleStateChange()?{
if(xmlHttp.readyState?==?4)?{
?????if(xmlHttp.status?==?200)?{
????????????alert("The?server?replied?with:"?+?xmlHttp.responseText);
??????? ?}??
? ?}
}
function?startRequest(){
??? createXMLHttpRequest();
??? xmlHttp.onreadystatechange?=?handleStateChange;????
xmlHttp.open("GET","simpleResponse.xml",true);
xmlHttp.send(null);
}?
</script>
</head>
<body>
????????
<input type="button" value="Start?Basic?Asynchronous?Request"
onclick="startRequest()"/>
? ???
</body>
</html>