代码示例:(标识:xmle_xmlhttprequest_vb)
<html>
<head>
<script type="text/vbscript">
dim xmlhttp
function loadXMLDoc(url)
set xmlhttp=createObject("Microsoft.XMLHTTP")
xmlhttp.onreadystatechange=getRef("state_Change")
call xmlhttp.open("GET",url,true)
call xmlhttp.send()
end function
function state_Change()
if xmlhttp.readyState=4 then
if xmlhttp.status=200 then
alert("XML data OK")
document.getElementById("A1").innerText=xmlhttp.status
document.getElementById("A2").innerText=xmlhttp.statusText
document.getElementById("A3").innerText=xmlhttp.responseText
else
alert("Problem retrieving XML data:" & xmlhttp.statusText)
end if
end if
end function
</script>
</head>
<body onload="loadXMLDoc('/static/demo/xml/note.xml')">
<h2>Using the HttpRequest Object</h2>
<p><b>status:</b>
<span id="A1"></span>
</p>
<p><b>status text:</b>
<span id="A2"></span>
</p>
<p><b>response:</b>
<br /><span id="A3"></span>
</p>
</body>
</html>