riwsh
(riwsh)
高级会员

资深会员
UID 28086
精华
0
积分 854
帖子 835
金钱 854 喜悦币
威望 0
人脉 0
阅读权限 50
注册 2004-4-26 来自 天津、浙江
状态 离线
|
[广告]: q
m
[PHP]XMLHTTP无刷新技术
如何做一个XMLHTTP无刷新页?我找了一段代码但是只有一半,还有"test.php"这个没有!有没有人帮我补一下?
<? function loadXMLTreeDoc() { var url = "/test.php"; // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); //req.setRequestHeader("text","text"); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'); req.send(null); // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { isIE = true; req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = processReqChange; req.open("GET", url, true); //req.setRequestHeader("text","text"); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'); req.send(); } } //refresh on time setTimeout( "loadXMLTreeDoc()" , 500 ); } // handle onreadystatechange event of req object function processReqChange() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.all.t.innerHTML=req.responseText; req=null; } else { alert("Sorry,there was a problem retrieving the XML data, please check network!"); } } } ?> [ 本帖最后由 riwsh 于 2006-9-13 05:08 PM 编辑 ]
|  www.163yongheng.com
happy9191,就要娱乐网
我的中国心在线制作 |
|