Header("Content-Type:text/html; charset=utf-8");
// AK QQ:42220796
// 总数 单页条数 当前页 点击后的url地址get 应用的js函数 显示几个 显示的地址
function AjaxPage($Total,$ListNub,$CurrentPage,$Url,$AjaxAction,$HalfPer=,$ViewId=)
{
//计算总页数
$totalPage = @ceil($Total/$ListNub);
$total=$totalPage-1;
$re="";
//echo $CurrentPage;
$re .= ( $CurrentPage > 0 )
?
"
href="javascript:$AjaxAction($Url=0,$ViewId)"">首页 |
href="javascript:$AjaxAction(".$Url."=".($CurrentPage-1).",$ViewId)"">上一页 |
"
:
"
首页 |
上一页 |
";
for ( $i =
$CurrentPage - $HalfPer,$i > 0 || $i = 0 , $j =
$CurrentPage + $HalfPer, $j < $totalPage || $j = $totalPage;$i < $j ;$i++
)
{
$re .= $i == $CurrentPage
?
"
[" . ( $i + 1 ) . "] |
"
: "
href="javascript:$AjaxAction($Url=$i,$ViewId)">" . ( $i + 1 ) . " |
";
}
$re .= ( $CurrentPage < $total
)
? "
href="javascript:$AjaxAction(".$Url."=".($CurrentPage+1).",$ViewId)"">下一页 |
href="javascript:$AjaxAction(".$Url."=".($total).",$ViewId)"">尾页
| "
:
"
下一页 |
尾页 |
";
$re="
style=text-align:center>$re
";
return
$re;
}
//总页数,传递的页面变量-当前页 url地址 前后各多少页
$page = $_GET[page];
//echo
page(10,$page,index.php?page,2);
?>
echo
AjaxPage(200,20,$page,rand.php?page,ajaxaction,2,nike);
?>
http://www.bkjia.com/PHPjc/486598.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486598.htmlTechArticle?php Header("Content-Type:text/html; charset=utf-8"); // AK QQ:42220796 // 总数 单页条数 当前页 点击后的url地址get 应用的js函数 显示几个 显示的地址 fun...