|
PHP Ajax分页显示数据(2)
2008-06-13 09:17
客户端文件比较简单,其代码如下所示: <html><head> <script> function viewpage(p){ if(window.XMLHttpRequest){ var xmlReq = new XMLHttpRequest(); } else if(window.ActiveXObject) { var xmlReq = new ActiveXObject('Microsoft.XMLHTTP'); } var formData = "page="+p; xmlReq.onreadystatechange = function(){ if(xmlReq.readyState == 4){ document.getElementById('content2').innerHTML = xmlReq.responseText; } } xmlReq.open("post", "Example8_7_1.php", true); xmlReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlReq.send(formData); return false; } </script> <head> <body > <h3 align="center">数据分页显示</h3> <div id="content2"></div> </body>
|