0001. Paging

Source: Internet
Author: User

1. The pages on the home page, the last page, the previous page, and the next page (the first page is a fixed row, unchanged)

  

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml"> View code

 

2. pages on the home page, last page, previous page, and next page (no fixed Rows)

VaR totalpage = 1; // total number of pages
VaR currentpage = 1; // current page number
Gettackoutpage = function (PNO, psize) {var itable = document. getelementbyid ("tackoutsundryorderlist"); var Lis = itable. getelementsbytagname ("Li"); var num = Lis. length; // ul rows totalpage = 0; // total number of pages pagesize = psize; // The number of lines displayed on each page if (Num-1) /pagesize> = parseint (Num-1)/pagesize) {totalpage = parseint (Num-1)/pagesize) + 1 ;} else {totalpage = parseint (Num-1)/pagesize);} currentpa GE = PNO; // the current page number var startrow = (currentpage-1) * pagesize; // start to display the row var endrow = currentpage * pagesize; // end the row endrow = (endrow> num )? Num: endrow; For (VAR I = 0; I <num; I ++) {if (I> = startrow & I <endrow) {Lis [I]. style. display = 'block';} else {Lis [I]. style. display = 'none';} var pageend = document. getelementbyid ("tackoutendpage"); tackoutfirstpage. removeclass (); tackoutprevpage. removeclass (); tackoutnextpage. removeclass (); endpage. removeclass (); If (currentpage> 1) {tackoutfirstpage. ATTR ("disabled", false); tackoutfirstpage. addclass ("tackouthomepage");} else {tackoutfirstpage. ATTR ("disabled", true); tackoutfirstpage. addclass ("tackouthomepageunable");} If (currentpage> 1) {tackoutprevpage. ATTR ("disabled", false); tackoutprevpage. addclass ("tackoutprevpage");} else {tackoutprevpage. ATTR ("disabled", true); tackoutprevpage. addclass ("tackoutprevpageunable");} If (currentpage <totalpage) {tackoutnextpage. ATTR ("disabled", false); tackoutnextpage. addclass ("tackoutnextpage");} else {tackoutnextpage. ATTR ("disabled", true); tackoutnextpage. addclass ("tackoutnextpageunable");} If (currentpage <totalpage) {endpage. ATTR ("disabled", false); endpage. addclass ("tackoutendpage");} else {endpage. ATTR ("disabled", true); endpage. addclass ("tackoutendpageunable ");}};
// Click events on the homepage
Tackoutfirstpage. On ('click', function (){
Gettackoutpage (1, 8 );
});

// Click Event on the previous page
Tackoutprevpage. On ('click', function (){
Gettackoutpage (currentpage-1, 8 );
});

// Click events on the next page
Tackoutnextpage. On ('click', function (){
Gettackoutpage (currentpage + 1, 8 );
});

// Click Event on the last page
Endpage. On ('click', function (){
Gettackoutpage (totalpage, 8 );
});

3. pagination can have links to multiple pages

  

 

0001. Paging

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.