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 < clen)
{
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