Maison >développement back-end >tutoriel php >php ajax 分页一_PHP教程
ajax分页 php ajax 分页 java ajax分页 asp.net ajax分页 jquery ajax 分页 jsp ajax无刷新分页 asp ajax分页 ajax 分页问题 ajax实现分页 ajax jsp分页
ajax 分页用的是在客户端分析数据,然后再发给php文件进行处理,返回给客户端处理理,思路就是这样的.
这里用到了三个文件js文件和一个php文件:cookie.js page.js proptype.js result.php文件,我们一一来看每个文件的内容吧.
先看cookie.js代码:
// JavaScript Document
function SetCookie (name,value,x_expires,x_path,x_domain,x_secure){ //设置一个Cookie值函数
//alert(name)
var argv = SetCookie.arguments;
//alert(this.argv);
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? x_expires : null;
var path = (argc > 3) ? x_path : null;
var domain = (argc > 4) ? x_domain : null;
var secure = (argc > 5) ? x_secure : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function GetCookie (name) { //读取指定名称的cookie值函数
// alert(document.cookie)
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(";", i);
if (i == -1) break;
i+=2;
}
return null;
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function DeleteCookie (name) { //删除Cookie值函数
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
这个文件主是要处理cookie