Home  >  Article  >  Backend Development  >  ajax no refresh paging, supports id positioning_PHP tutorial

ajax no refresh paging, supports id positioning_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:37:14970browse

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);
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486598.htmlTechArticle?php Header("Content-Type:text/html; charset=utf-8"); // AK QQ:42220796 // 总数 单页条数 当前页 点击后的url地址get 应用的js函数 显示几个 显示的地址 fun...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn