반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | function makePage(page){ if(typeof page == "undefined"){ page = 1; //현재페이지 } var totalConunt = 3846; //전체로우수 var pageRowSize = 20; // 화면에 보여줄 로우수 var pageCount = Math.ceil((totalConunt / pageRowSize )) // 전체페이지수 var listOffset = 10; // 한화면에 보여줄 페이지수 var startPage = Math.ceil(page / listOffset) * listOffset - (listOffset - 1); var endPage = (startPage + listOffset - 1 > pageCount) ? pageCount : startPage + listOffset - 1; var prev2 = "1"; //맨처음페이지 var prev = (startPage > 1 ? startPage - 1 : 1) ; //처음페이지(10개단위) var next = (endPage < pageCount ? endPage + 1 : endPage); //다음페이지(10개단위) var next2 = pageCount; //맨마지막페이지 var AXGridPagingHtml = ''; AXGridPagingHtml += '<div class="paging">'; AXGridPagingHtml += '</div>'; AXGridPagingHtml += '<span class="arrow">'; AXGridPagingHtml += '<a href="javascript:fn_search('+prev2+')"><img src="/style2/images/btn_prev2.gif" alt="처음 페이지"></a>'; AXGridPagingHtml += '<a href="javascript:fn_search('+prev+')"><img src="/style2/images/btn_prev.gif" alt="이전 페이지"></a>'; AXGridPagingHtml += '</span>'; AXGridPagingHtml += '<span class="list">'; for(var i = startPage ; i < endPage ; i++){ if(i == page){ AXGridPagingHtml += '<strong>'+i+'</strong>'; }else{ AXGridPagingHtml += ' <a href="javascript:fn_search('+i+')">'+i+'</a> '; } } AXGridPagingHtml += '</span>'; AXGridPagingHtml += '<span class="arrow">'; AXGridPagingHtml += '<a href="javascript:fn_search('+next+')"><img src="/style2/images/btn_next.gif" alt="다음 페이지"></a>'; AXGridPagingHtml += '<a href="javascript:fn_search('+next2+')"><img src="/style2/images/btn_next2.gif" alt="마지막 페이지"></a>'; AXGridPagingHtml += '</span>'; $("#AXGridPaging").html(AXGridPagingHtml); } $(document).ready(function() { makePage(); }); | cs |