php ajax 分页phpapi,ajax分页_php ajax分页代码

摘要 腾兴网为您分享:php ajax分页代码,智慧农业,长沙银行,一折包邮,信和财富等软件知识,以及381.65,红娘牵线,中经油马,战地小,歌词制作,唯美会,微软必应输入法,邓州在线,螺丝钉,侠客风云传补丁,打方块,创创营销,华为荣耀9,加勒比海盗高清壁纸,中国信鸽赛事等软件it资讯,欢迎关注腾兴网。html head script language=javascript function createXMLHttp(){ if(window.ActiveXObject){ return new ActiveXObject(Microsoft.XMLHttp); } else if(window.XMLHttpRequest){ return new XMLHttpRequest(); } } function Pager(){ var that=this; this.l...

function createXMLHttp(){

if(window.ActiveXObject){

return new ActiveXObject("Microsoft.XMLHttp");

}

else if(window.XMLHttpRequest){

return new XMLHttpRequest();

}

}

function Pager(){

var that=this;

this.link=function(url){

that.xmlHttp = createXMLHttp();

that.xmlHttp.onreadystatechange = that.receive;

that.xmlHttp.open("GET", url, true);

that.xmlHttp.send(null);

}

this.receive=function(){

if((that.xmlHttp.readyState == 4)){

if(that.xmlHttp.status == 200){

that.reaction(that.xmlHttp.responseXML);

}else{

that.recover();

}

}

}

}

var a = new Pager();

var pages = 0;

a.recover = function (){

go = function (u){

go = function (){

};

a.link(u);

};

};

a.reaction = function (xml){

document.getElementById('page_content').innerHTML = xml.getElementsByTagName('content')[0].childNodes[0].nodeValue;

if(xml.getElementsByTagName('count')[0].childNodes[0].nodeValue != pages){

s = '

for(i = 1; i <= xml.getElementsByTagName('count')[0].childNodes[0].nodeValue; i)

{

if(i == xml.getElementsByTagName('current')[0].childNodes[0].nodeValue)

s= '

' i '';

else

s= '

' i '';

}

s= '

';

document.getElementById('page_bar').innerHTML = s;

}

a.recover();

}

a.link('page.php');

page.php代码.

class class_page

{

private $record_count, $perpage;

private $page_count, $page_current;

function __construct($perpage, $record_count, $page_current)

{

$this->perpage = $perpage;

$this->record_count = $record_count;

$this->page_count = ($record_count == 0) ? 1 : ceil($record_count / $perpage);

$this->page_current = ($page_current > $this->page_count) ? 1 : $page_current;

}

function __get($name)

{

switch($name)

{

case 'page_count':

return $this->page_count;

case 'page_current':

return $this->page_current;

case 'record_start':

return ($this->page_current - 1) * $this->perpage;

}

}

}

header('Content-Type: text/xml; charset=gbk');

$page = new class_page(20, 150, is_numeric($_GET['page']) ? $_GET['page'] : 1);

echo '<?xml version="1.0"?>';

echo '';

echo '' . $page->page_count . '';

echo '' . $page->page_current . '';

echo '' . pow($page->page_current, 2) . '';

echo '';

?>

相关推荐

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值