Home  >  Article  >  Backend Development  >  php?分页

php?分页

WBOY
WBOYOriginal
2016-06-20 12:44:32812browse

分页的时候,页数不固定,页数也很多,下面这个js要怎么修改

 <a id="a1" href="">第一页</a> <a id="a2" href="">第二页</a> <a id="a3" href="">第三页</a>............<script>        $(function() {            $('#a1').click(function () {                $('body').load('index.php?page=1')                return false;            });            $('#a2').click(function () {                $('body').load('index.php?page=2')                return false;            });            $('#a3').click(function () {                $('body').load('index.php?page=3')                return false;            });................        });    </script>


回复讨论(解决方案)

<script src=scripts/jquery-1.8.3.min.js></script><script>$(function() {  $('a[id^=a]').click(function () {    $('#list').load('list.php?page=' + $(this).attr('id').substr(1))    return false;  });});</script><a id="a1" href="#">第一页</a><a id="a2" href="#">第二页</a><a id="a3" href="#">第三页</a><div id="list"></div>
list.php
<?phpprint_r($_GET);

实际上分页条是由 php 生成的,应是这样的形式
第一页
第二页
第三页

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
Previous article:php?缓存Next article:PHP原码,反码,补码介绍