ListView page JS Implementation of PHP pseudo-paging

Source: Internet
Author: User
The JS code is as follows:

Copy the Code code as follows:



Maximum data volume
var total= "100";
The amount of display per page
var pagesize=10;
How many pages are there?
var pagenum=math.ceil (total/pagesize);
Build navigation
function Initpage (nowpage) {
var pagenav= ' previous page ';
for (i=1;i<=pagenum;i++) {
Pagenav + = (i==nowpage)? ' ' + i + '': ' + i + ';
}
Pagenav + = ' next page ';
document.getElementById (' pages '). Innerhtml=pagenav;
}
Page
function GoToPage (page) {
var start= (page-1) *pagesize;
var max=page*pagesize;
for (Vs=0;vs
Varōbj=document.getelementbyid (' item_ ' + vs);
Obj.style.display= "None";
}
if (max>total) max=total;
for (v=start;v
Varōbj=document.getelementbyid (' item_ ' + V);
obj.style.display= "Block";
}
Initpage (page);
}
Previous page
function up (nowpage) {
if (nowpage==1) return false;
if (nowpage>1) goToPage ((nowpage-1));
}
Next page
function down (nowpage) {
if (Nowpage==pagenum) return false;
if (nowpage
}



If the data is
  • .........

  • .........

  • ...........
  • ........

  • Then you can show a navigation similar to this:
    Prev 1 2 3 4 next page
    Then click on the page or the upper and lower pages to toggle the display.

    Time is quite hasty, say so many, everybody own analysis code, have not understood please message

    The above describes the ListView page JS implementation of PHP pseudo-page, including the ListView page content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.