js 代码
- <script type="text/javascript">
- var xmlHttp;
- function createXMLHttpRequest() {
- if (window.ActiveXObject) {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- else if (window.XMLHttpRequest) {
- xmlHttp = new XMLHttpRequest();
- }
- }
- function startRequest() {
- createXMLHttpRequest();
- xmlHttp.onreadystatechange = handleStateChange;
- xmlHttp.open("GET", "innerHTML.xml", true);
- xmlHttp.send(null);
- }
- function handleStateChange() {
- if(xmlHttp.readyState == 4) {
- if(xmlHttp.status == 200) {
- document.getElementById("results").innerHTML = xmlHttp.responseText;
- }
- }
- }
- </script>
xml 代码
- <table border="1">
- <tbody>
- <tr>
- <th>Activity Nameth>
- <th>Locationth>
- <th>Timeth>
- tr>
- <tr>
- <td>Waterskiingtd>
- <td>Dock #1td>
- <td>9:00 AMtd>
- tr>
- <tr>
- <td>Volleyballtd>
- <td>East Courttd>
- <td>2:00 PMtd>
- tr>
- <tr>
- <td>Hikingtd>
- <td>Trail 3td>
- <td>3:30 PMtd>
- tr>
- tbody>
- table>