当先锋百科网

首页 1 2 3 4 5 6 7
<script type="text/javascript">
 var xmlHttp;
 function loadXMLDoc(url)
 {
 alert("hello");
 if(window.XMLHttpRequest)
 {
 xmlHttp = new XMLHttpRequest();
 alert("one");
 }
 if(xmlHttp != null)
 {
 alert("two");
 xmlHttp.onreadystatechange = StateChange;
 xmlHttp.open("POST",url,true);
 xmlHttp.send(null);
 }
 }
 function StateChange()
 {
 if(xmlHttp.readyState == 4)
 {
 if(xmlHttp.status == 200)
 {
 document.getElementById("body").innerHTML = xmlHttp.responseText;
 }
 }
 }
 </script>
 </head>

 <body>
 <div id="body"></div>
 <button type="button" onClick="loadXMLDoc('./one.txt')">
 Click
 </button>
 </body>