<!DOCTYPEhtml>
<html>
<head>
<title>sharejs.com</title>
<script>
functionloadXMLDoc()
{
varxmlhttp;
if(window.XMLHttpRequest)
{//codeforIE7+,Firefox,Chrome,Opera,Safari
xmlhttp=newXMLHttpRequest();
}
else
{//codeforIE6,IE5
xmlhttp=newActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>
<divid="myDiv"><h2>LetAJAXchangethistext</h2></div>
<buttontype="button"onclick="loadXMLDoc()">ChangeContent</button>
</body>
</html>
|