Home > Backend Development > PHP Tutorial > 比较全面的php分页领航类

比较全面的php分页领航类

WBOY
Release: 2016-06-13 13:09:04
Original
786 people have browsed it

比较全面的php分页导航类

POST方式分页:http://hudeyong926.iteye.com/blog/764703

<script language="javascript">
//函数跳转到指定页面
function gotoPage(page)
{
    document.getElementById("page").value = page;  //隐藏表单的页控件
    document.getElementById("searchForm").submit();
}
</script>

<!-- 表单参考如下 -->
Copy after login
$perpage) { $offset = 2; $realpages = @ceil($num / $perpage); $pages = $maxpages && $maxpages $pages) { $from = 1; $to = $pages; } else { $from = $curpage - $offset; $to = $from + $page - 1; if ($from $pages) { $from = $pages - $page + 1; $to = $pages; } } //注意下面href后面我增加了一个#号,让链接失效,在后面增加onclick函数 $multipage = ($curpage - $offset > 1 && $pages > $page ? '1 ...' : '') . ($curpage > 1 && !$simple ? '' : ''); for($i = $from; $i ' . $i . '' : '' . $i . ''; } $multipage .= ($curpage ??' : '') . ($to ... ' . $realpages . '' : '') . //下面这一行注释掉,改了一下超过10页,可以手动输入页码跳转到指定页面函数 (!$simple && $pages > $page ? '' : ''); $multipage = $multipage ? '
' . (!$simple ? '共' . $num . '条' : '') . $multipage . '
' : ''; } return $multipage; } ?>

GET方式分页:

布局在页面左边的:

?

?

?

?

布局在页面中间的



?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

布局在页面的右边

?

Related labels:
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