Complete paging query functionality with JavaScript

Source: Internet
Author: User

Main ideas:

The key to implementing a paging query is to set the maximum number of data rows and the start line numbers for a page, with the following code:

Maximum number of rows we set it to constant, not to dwell on him, so the key is how to set the starting line number to a variable, and let him change as we click on "Previous Page" or "next page".

First look at the top-level code:

<script>function up () {var b= document.getElementById ("Hidd"); var a=B.value; A=parseint (a); if(a>=4) {a-=4    }    Else{alert ("Now is the homepage")} B.value=A;} function down () {var e= document.getElementById ("Hidde"). Value; E=parseint (e); var b= document.getElementById ("Hidd"); var a=B.value; A=parseint (a); if(e!=0) {a+=4    }    Else{alert ("Now is the last page"); } b.value=A;}</script>

When we click "Next Page", the onclick event is triggered, the starting line number is changed, and the form is submitted. After the form is submitted, pass the parameters to the following methods:

The method can return the starting line number we just changed.

The start line number is passed to the past by the method call of paged query, which realizes the refresh of the page.

Here is the illustration:

Complete paging query functionality with JavaScript

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.