spring

[javascrtipt] 페이징

shaneguy 2019. 8. 1. 17:02
           pageBlock : function(currentPage, startPage, endPage, lastPage){
				var blockSize = 10;
				var html = "";
				currentPage = Number(currentPage);
				if(currentPage> blockSize)
					html+="<a href='javascript:p.show.list("+(currentPage-blockSize)+")'>&lt;&lt;&nbsp;&nbsp;</a></div>";
				else
					html+="</div>";
				
				for(var i=Number(startPage); i<=Number(endPage);i++){
					if(i== currentPage){
						html+="<a href='javascript:p.show.list("+i+")'><b>"+i+'</b></a>&nbsp;';
					}
					else
						html+="<a href='javascript:p.show.list("+i+")'>"+i+'</a>&nbsp;';
				}
				
				if(currentPage+blockSize< lastPage)
					html+="<a href='javascript:p.show.list("+(currentPage+blockSize)+")'>&nbsp;&gt;&gt;</a></div>";
				else
					html+="</div>";
				
				return html;
			}