<html>
<head>
<title>XMLHTTPRequest对象的说明DEMO</title>
<script language="javascript" type="text/javascript">
var xmlhttp;
function createXMLHTTPRequext(){
if(window.ActiveXObject) {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
else if(window.XMLHTTPRequest){
xmlhttp = new XMLHTTPRequest();
}
}
function PostOrder(xmldoc)
{
createXMLHTTPRequext();
}
function HandleStateChange()
{
if (xmlhttp.readyState == 4){
document.frmTest.myButton.disabled = false;
alert(xmlhttp.responseBody);
alert(xmlhttp.responseStream);
alert(xmlhttp.responseText);
alert("Result = " + xmlhttp.responseXML.xml);
alert(xmlhttp.status);
alert(xmlhttp.statusText);
}
}
</script>
</head>
<body>
<form name="frmTest">
<input name="myButton" type="button" value="ClickMe" onclick="PostOrder('http://localhost/example.htm');">
</form>
</body>
</html>