ajax no refresh paging, supports id positioning_PHP tutorial

WBOY
Release: 2016-07-13 17:37:14
Original
926 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!