php?分页

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 12:44:32
Original
882 people have browsed it

分页的时候,页数不固定,页数也很多,下面这个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>
Copy after login


回复讨论(解决方案)

<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>
Copy after login
list.php
<?phpprint_r($_GET);
Copy after login

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

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