ASP-AJAX-分页格式

HTML:

 1 <html>
 2 <head>
 3 <title>Mazey</title>
 4 <meta name="description" content="" />
 5 <meta name="keywords" content="" />
 6 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
 7 <!-- Mazey's CSS -->
 8 <link type="text/css" href="http://www.mazey.cn/css/mazey-base.css" rel="stylesheet" />
 9 <link type="text/css" href="css/records-main.css" rel="stylesheet" />
10 <!-- Mazey's jQuery -->
11 <script language="javascript" type="text/javascript" src="http://www.mazey.cn/js/plugin/jquery/jquery-2.1.1.min.js"></script>
12 <!-- Mazey's Bootstrap -->
13 <link type="text/css" href="http://www.mazey.cn/config/frame/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
14 <script language="javascript" type="text/javascript" src="http://www.mazey.cn/config/frame/bootstrap/js/bootstrap.min.js"></script>
15 <!-- Mazey's Layer -->
16 <script language="javascript" type="text/javascript" src="http://www.mazey.cn/js/plugin/layer/layer.js"></script>
17 <script language="javascript" type="text/javascript" src="http://www.mazey.cn/js/plugin/layer/mazey-layer.js"></script>
18 <!-- Records-System's Favicon -->
19 <link rel="shortcut icon" type="image/x-icon" href="images/favicon/favicon.ico">
20 </head>
21 <body>
22 <!--header-->
23 <div class="header">
24 </div>
25 <!--content-->
26 <section class="content">
27     <div class="table-domain container">
28         <div class="row">
29             <div class="col-sm-12" id="domain-content">
30                 <table class="table table-striped table-bordered table-hover table-responsive">
31                     <thead>
32                         <tr>
33                             <th>load...</th>
34                             <th>load...</th>
35                             <th>load...</th>
36                         </tr>
37                     </thead>
38                     <tbody>
39                         <tr>
40                             <td>load...</td>
41                             <td>load...</td>
42                             <td>load...</td>
43                         </tr>
44                     </tbody>
45                 </table>
46             </div>
47         </div>
48     </div>
49 </section>
50 <!--footer-->
51 <section class="footer">
52 </section>
53 </body>
54 </html>
55 <!-- Records-System's JS -->
56 <script language="javascript" type="text/javascript" src="js/records-main.js"></script>

JavaScript:

 1 function loadInfo(page){
 2     sendInfo="judge=0322&page="+page;
 3     var loadOne = layer.load(2);
 4     $.ajax({
 5         type:"post",
 6         url:"Mazey.cn",
 7         async:true,
 8         timeout:5000,
 9         dataType: "text",
10         data:sendInfo,    
11         success:function(data){
12             layer.close(loadOne);
13             myArr=data.split("-|-")
14             if("0507"==myArr[0]){
15                 $("#domain-content").html(myArr[1]);
16             }else if("0215"==myArr[0]){
17                 $("#domain-content").html(myArr[1]);
18             }
19         },
20         error:function(){
21             layer.close(loadOne);
22             AlertMazey.alertSad("System Error!");
23         }    
24     });
25 }
26 $(document).ready(function(){
27     loadInfo(1);
28     $('#view').on('click', function(){ 
29         loadInfo(413);
30     }); 
31 });

ASP:

 1 <%
 2 dim judge:judge=trim(request.form("judge"))
 3 dim page:page=trim(request.form("page"))
 4 if page="" then page=1
 5 select case judge
 6     case "0322"
 7         connRc.open
 8         sqlFirst=""
 9         session("sqlSearch")=sqlFirst
10         rsMz1.open session("sqlSearch"),connRc,1,1
11         countYes=true
12         if rsMz1.eof then
13             Response.write "0215-|-"
14 %>
15 <table class="table table-striped table-bordered table-hover table-responsive">
16     <thead>
17         <tr>
18             <th>暂无数据</th>
19         </tr>
20     </thead>
21 </table>
22 <%
23             Response.end
24         else
25             rsMz1.PageSize = 10
26             rsPageCount = rsMz1.PageCount
27             flag = page - rsPageCount
28             If Page < 1 or flag >0 then Page = 1
29             rsMz1.AbsolutePage = Page
30             recordcount = rsMz1.recordcount
31         end if
32         response.write "0507-|-"
33 %>
34 <table class="table table-striped table-bordered table-hover table-responsive">
35     <thead>
36         <tr>
37             <th>主题</th>
38         </tr>
39     </thead>
40     <tbody>
41 <%
42         i=1
43         do while not rsMz1.eof and i<11
44 
45 %>
46         <tr>
47             <td>内容</td>
48         </tr>
49 <%
50         i=i+1
51         rsMz1.movenext
52         loop  
53 %>
54         <tr>
55             <td colspan="7">
56                 <a class="btn btn-default disabled page-total">共<%=recordcount%>条记录</a>
57                 <a class="btn btn-default" id="page-begin" onclick="loadInfo(1);">首页</a>
58                 <a class="btn btn-default" id="page-previous" onclick="loadInfo(<%=page-1%>);">上一页</a>
59                 <a class="btn btn-default"><%=page&"/"&rsPageCount%></a>
60                 <a class="btn btn-default" id="page-next" onclick="loadInfo(<%=page+1%>);">下一页</a>
61                 <a class="btn btn-default" id="page-end" onclick="loadInfo(<%=rsPageCount%>);">末页</a>
62             </td>
63         </tr>
64     </tbody>
65 </table>
66 <%
67         rsMz1.close        
68         connRc.close
69     case else
70         rspend "0215-|-This is an unknown error!"
71 end select
72 %>

 

posted @ 2017-03-19 22:48  除除  阅读(434)  评论(0编辑  收藏  举报