粗糙的jquery分页方法

一个简单的jquery分页,记录下来,以防自自己遗忘。可能不具有可读性,还请见谅!请恕java后台代码不展现!

jsp页面部分:

    < DIV  class = " CC_RC " >
               
< UL  class = ' CC_Title ' >< LI  class = ' CC_TitleName ' > 任务名称 </ LI >< LI  class = ' CC_TechTypeName ' > 所属行业 </ LI >< LI > 设计费用(¥) </ LI >< LI > 发布日期 </ LI ></ UL >
           
< div id = " technologyRInfoDIV " >
                  
< jsp:include page = " /homePage.do?method=getTechnologyRInfo " ></ jsp:include >     
           
</ div >  
           
            
< div id = " techRPageInfo "  align = " right "   >
           
</ div >  
           
</ DIV >


js部分:

$(document).ready(function() {

        $.ajax(
{
           type: 
"POST",
           url: 
"./homePage.do?method=getTechnologyRInfoPageSize",          
           success: function(msg)
           
{
             var pageLength 
= parseInt(msg);
             
if(pageLength>1){        
                   $(
"#techRPageInfo").append("<a href='#' onClick='return  techRPage("+ pageLength +","+ pageLength +");'  >上一页   </a>");
                   $(
"#techRPageInfo").append("<a href='#' onClick='return  techRPage(2,"+ pageLength +");'  >下一页   </a>");
                 }

              

           }

          }
)    

}
);




    function techRPage(curpage,maxLength)
{
        $.ajax(
{
           type: 
"POST",
           url: 
"./homePage.do?method=getTechnologyRInfo&curpage="+curpage,       
           success: function(msg)
           
{
             $(
"#technologyRInfoDIV").html("");
             $(
"#technologyRInfoDIV").html(msg);
             $(
"#techRPageInfo").html("");
             var previPage 
= curpage - 1;
             
if(previPage == 0) previPage = maxLength ;
             $(
"#techRPageInfo").append("<a href='#' onClick='return  techRPage("+ previPage +","+ maxLength +");'  >上一页   </a>");
             var nextPage 
= 0 ;
             
if(curpage < maxLength){
              nextpage 
= curpage + 1 ;
             $(
"#techRPageInfo").append("<a href='#' onClick='return  techRPage("+ nextpage +","+ maxLength +");'  >下一页   </a>");
             }
else if(curpage == maxLength){
             $(
"#techRPageInfo").append("<a href='#' onClick='return  techRPage(1,"+ maxLength +");'  >下一页   </a>");
             }


           }

          }
)
        }

你可能感兴趣的:(粗糙的jquery分页方法)