Js write paging, js Paging

Source: Internet
Author: User

Js write paging, js Paging

Jsp: <input value ="1"Id ="Current"Type ="Hidden"/>

<Div id = "FenYe"> </Div> js: // four-level drop-down relationship with data $ ( Function() {// Query all fenye (1); chuliYeMa ();}); VarTotalPage; // The paging method. FunctionFenye (current ){ If(Current = Undefined) {Current = 1;} // put the clicked page into the hidden box $ ("# current"). val (current); // detailed cause VarXxYuanyinSelLen = $ ("# xxYuanyinSel option"). length; VarXxYuanyinSelVal = $ ("# xxYuanyinSel option: selected"). val (); // detailed location VarXxbuweiSelLen = $ ("# xxbuweiSel option"). length; VarXxbuweiSelVal = $ ("# xxbuweiSel option: selected"). val (); // location VarBuweiClassSelLen = $ ("# buweiClassSel option"). length; VarBuweiClassSelVal = $ ("# buweiClassSel option: selected"). val (); // Project VarXiangMuClassSelLen = $ ("# xiangMuClassSel option"). length; VarXiangMuClassSelVal = $ ("# xiangMuClassSel option: selected"). val (); // refresh table data If(XxYuanyinSelLen! = 0 & xxYuanyinSelVal! = "0") {// query by detailed reason VarClassName = "xxyuanyin"; fenyeGetMsg (className, xxYuanyinSelVal, current); // getTotalPage (className, xxYuanyinSelVal) is displayed during query );} Else if(XxbuweiSelLen! = 0 & xxbuweiSelVal! = "0") {// query by detailed parts VarClassName = "xxbuwei"; fenyeGetMsg (className, xxbuweiSelVal, current); // getTotalPage (className, xxbuweiSelVal) is displayed during query );} Else if(BuweiClassSelLen! = 0 & buweiClassSelVal! = "0") {// query by location VarClassName = "buweiClass"; fenyeGetMsg (className, buweiClassSelVal, current); // getTotalPage (className, buweiClassSelVal) is displayed during query );} Else if(XiangMuClassSelLen! = 0 & xiangMuClassSelVal! = "0") {// query by project VarClassName = "xiangmuClass"; fenyeGetMsg (className, xiangMuClassSelVal, current); // getTotalPage (className, xiangMuClassSelVal) is displayed during query );} Else if(XiangMuClassSelVal = "0") {// query all by default, and select the first level to query all VarClassName = "xiangmuClass"; fenyeGetMsg (className, xiangMuClassSelVal, current); // the total number of pages retrieved during query getTotalPage (className, expiration);} // process the page number chuliYeMa ();} // process the page number FunctionChuliYeMa (){ VarCurrent = $ ("# current"). val (); VarShang = current * 1-1; VarXia = current * 1 + 1; VarStr = ""; If(Current> 1) {str + = "<a href = 'javascript: fenye (" + shang + "); '> previous page </a> & nbsp ;"} Else{Str + = "<a> previous page </a> & nbsp ;"} For( VarI = 1; I <= totalPage; I ++ ){ If(I = current) {str + = "<a class = '" + I + "'>" + I + "</a> & nbsp ;"} Else{Str + = "<a href = 'javascript: fenye (" + I + "); '>" + I + "</a> & nbsp ;"}} If(Current <totalPage) {str + = "<a href = 'javascript: fenye (" + xia + "); '> next page </a> <br/> "} Else{Str + = "<a> next page </a> <br/>" }$ ("# fenYe" ).html (str);} // obtain the total number of pages FunctionGetTotalPage (className, id) {$. ajax ({url: '$ {pageContext. request. contextPath}/SchoolController/findSmTotalPageByClass ', data: {"className": className, "id": id}, type: "post", success: Function(Data) {totalPage = data;}, error: Function() {Alert ("querying the total number of pages failed") ;}, async: False });} // Retrieve data from the page FunctionFenyeGetMsg (className, id, current) {$. ajax ({url: '$ {pageContext. request. contextPath}/SchoolController/findMessageByClass ', data: {"className": className, "id": id, "current": current}, type: "post", success: Function(Data ){ VarStr = ""; For( VarI = 0; I <data. length; I ++) {str + = "<a href = '$ {pageContext. request. contextPath}/SchoolController/smYulan. from? Id = "+ data [I]. id + "'target = '_ blank'>" + data [I]. title + "</a> & emsp;" + data [I]. createtime + "<br/>" }$ ("# schoolMessageTableTbody" ..html (str) ;}, error: Function() {}, Async: False });}

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.