国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP中利用 Jauery 實現(xiàn)AJAX分頁效果

2024-05-04 11:07:17
字體:
供稿:網(wǎng)友

準(zhǔn)備工作 Jquery-man.js

需要分頁地方

<script language="javascript">
function CheckPage(pages){
$("#plShow").load("plAjax.asp?ID=<%=news_id%>&p="+pages);
}
</script>

<div id="plShow">
 <script language="javascript">
    $("#plShow").load("plAjax.asp?ID=<%=news_id%>");
 </script>
</div>
<%

'完了,就是這么簡單 ...

%>

plAjax.asp 顯示分頁

<!--#include file="inc/conn.asp"-->
<%
   ID = request.QueryString("ID")
   if ID = "" or isnull("ID") then
      response.End()
   end if
   P = request.QueryString("p")
   if P = "" or isnull("P") then
      P = 1
   end if
   if P = 1 then
      sql = "select top 5 * from pl where byID='"&ID&"' order by id desc"
   else
   pz = 5*(P-1)
      sql = "select top 5 * from pl where id not in(select top "&pz&" id from pl where byID='"&ID&"' order by id desc) and byID='"&ID&"' order by id desc"
   end if
   response.Charset="gb2312"
   set rs = conn.execute(sql)
   if rs.eof then
      response.Write "<dl><dt style='color:#FF0000'>暫無評論!</dt></dl>"
   response.End()
   end if
   while not rs.eof
%>
<dl>
   <dt><img src="Image/page/face/<%=rs("face")%>.png" />&nbsp;
   <%
      if rs("isShow") then
      response.Write "游客"
   else
      response.Write rs("name")
   end if
   %>
   &nbsp;<%=rs("adddate")%> 發(fā)表
   </dt>
   <dt><%=rs("content")%></dt>
</dl>
<%
   rs.movenext
   wend
   rs.close
%>
<div style="height:40px;">

   <ul class="Page" style="margin-top:20px;">
<%

'這里采用了仿百度分頁效果
sql = "select count(*) as maxnum from pl where byID='"&ID&"'"
rs = conn.execute(sql)
maxnum = rs("maxnum")
if maxnum mod 5 then
   pageCount = int(maxnum/5)+1
else
   pageCount = maxnum/5
end if
if P = 1 or P<1 then
   response.Write "<li>首頁</li><li>上頁</li>"
else
   response.Write "<li><a href='javascript:void(0);' onclick='CheckPage(1)'>首頁</a></li><li><a href='javascript:void(0);' onclick='CheckPage("&P-1&")'>上頁</a></li>"
end if
if P>1 then a=1
if P>2 then a=2
if P>3 then a=3
if P>4 then a=4
if P>5 then a=4
for i=(P-a) to P-1
   response.Write "<li class='dpage'><a href='javascript:void(0);' onclick='CheckPage("&i&")'>"&i&"</a></li>"
next
response.Write  "<li>"&P&"</li>"
for j=(P+1) to (P+5)
   if j>pageCount then
      exit for
   end if
   response.Write "<li class='dpage'><a href='javascript:void(0);' onclick='CheckPage("&j&")'>"&j&"</a></li>"
next
if int(P) = int(pageCount) or int(pageCount) = 0 then
   response.Write "<li>下頁</li><li>尾頁</li>"
else
   response.Write "<li><a href='javascript:void(0);' onclick='CheckPage("&P+1&")'>下頁</a></li><li><a href='javascript:void(0);' onclick='CheckPage("&pageCount&")'>尾頁</a></li>"
end if
%> 
   </ul>
</div>

 
' 樣式表

.Page{
  width:auto; height:16px;
}
.Page li{
  display:inline; height:16px; line-height:16px; padding-left:6px; text-align:center; margin-left:5px; padding-right:5px
}
.Page .dpage{
 border:1px #D6D6D6 solid; background:#F7F7F7; font-weight:bold;
}

#plShow dl{
  height:auto; border-bottom:1px #D6D6D6 dashed; margin-top:8px; clear:both; width:95%;
}
#plShow dt{
  height:24px; text-align:left; line-height:24px; color:#666;
}

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 大同县| 辰溪县| 德惠市| 佛学| 宜宾市| 邹城市| 天柱县| 丰县| 犍为县| 灵台县| 灌南县| 黑河市| 齐河县| 崇信县| 宜阳县| 百色市| 鲁山县| 桐乡市| 丰台区| 翁牛特旗| 治多县| 资中县| 武安市| 通海县| 林口县| 临桂县| 瑞丽市| 睢宁县| 曲水县| 南溪县| 嘉黎县| 青阳县| 永吉县| 云林县| 印江| 沙洋县| 夏津县| 来凤县| 赤水市| 西宁市| 阿尔山市|