<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<script type="text/javascript">
var xmlhttp,alerted
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) {
alert("You must have Microsofts XML parsers available")
}
}
@else
alert("You must have JScript version 5 or above.")
xmlhttp=false
alerted=true
@end @*/
if (!xmlhttp && !alerted) {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
alert("You need a browser which supports an XMLHttpRequest Object.\nMozilla build 0.9.5 has this Object and IE5 and above, others may do, I don't know, any info jim@jibbering.com")
}
}
function RSchange() {
if (xmlhttp.readyState==4) {
document.getElementById('content').innerHTML=xmlhttp.responseText
}
}
function msg(){
alert(document.getElementById('content').innerHTML);
}
function go() {
if (xmlhttp) {
d=document
xmlhttp.open("GET", "http://www.163.com",true);
xmlhttp.onreadystatechange=RSchange
xmlhttp.send(null)
}
}
</script>
The content will appear between here
<div id=content>sssss</div> and here.<button onclick="go()">Do it</button><button onclick="msg()">test</button>
<a href="/2002/4/httprequest.html">More information on xmlhttprequest object, including fuller examples.</a>
<html>