日期:2014-05-16 浏览次数:20647 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>AjaxTest</title> </head> <body> <form action="" method="post" name="form1"> <input name="btn_1" type="button" value="test" onclick="startXML();"/> </form> <div id="tt"></div> <script language="JavaScript" type="text/javascript"> function startXML() { var requester=flase; if(window.ActiveXObject) { requester=new ActiveXObject("Microsoft.XMLHTTP"); } else if(window.XMLHttpRequest) { requester=new XMLHttpRequest(); } requester.open("GET","test.xml",true); requester.onreadystatechange=function() { if(requester.readyState==4) { if(requester.status==200) { document.getElementById('tt').innerHTML=requester.responseXML; } } }; requester.send(null); } </script> </body> </html>