jQuery 插件pagination应用

钱旻
2023-12-01

做了一个单的demo直接上代码,只是资源需要自己加载而已

有这个为基础,写相关的AJAX分页也就是很简单的事了

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Paging</title>
    <script type="text/javascript" src="misc/js/jquery.min.js"></script>
    <script type="text/javascript" src="misc/js/jquery.pagination.js"></script>
    <script type="text/javascript">
         function pageselectCallback(page_id, jq){
                   $('#Searchresult').text("Showing search results "+((page_id*10)+1)+"-"+((page_id*10)+10));
                  } 
         $(function(){
         $("#pagination").pagination(300,{
                     num_edge_entries: 2,
                    num_display_entries: 5,
                    callback: pageselectCallback
         });
        
         })
    </script>
    <style type="text/css">
        #pagination a{
         padding:4px;
        }
        #Searchresult{
        margin-top:15px;
        margin-bottom:15px;
        border:solid 1px #eef;
        padding:5px;
        background:#eef;
        }
    </style>
</head>
<body>
    <div id="pagination"  class="pagination">
    </div>
    <div id="Searchresult">
    Showing search results 1-10 ...
    </div>
</body>
</html>

 类似资料: