asp 翻页源码【原创】
<%
strSQL="select * from industry_article where author='"&session("username")&"' "
article_status=trim(request("article_status"))
if article_status<>"" then strSQL=strSQL&" and status='"&article_status&"' "
strSQL="select * from industry_article where author='"&session("username")&"' "
article_status=trim(request("article_status"))
if article_status<>"" then strSQL=strSQL&" and status='"&article_status&"' "
strSQL=strSQL&"order by pubdate desc"
set adoRS = server.CreateObject("adodb.recordset")
adoRS.Open strSQL,conn,3,1
if adoRS.bof and adoRS.eof then
response.write "暂无文章!" %>
<%
else
if adoRS.RecordCount>0 then
adoRS.PageSize=20'0每页显示的记录数 '显示标题时
total_page=adoRS.PageCount
total_red=adoRS.RecordCount
current_page=Request("me_page")
total_page=adoRS.PageCount
total_red=adoRS.RecordCount
current_page=Request("me_page")
if current_page="" then
current_page=1
elseif not isnumeric(current_page) then
current_page=1
else
current_page=cint(current_page)
end if
current_page=1
elseif not isnumeric(current_page) then
current_page=1
else
current_page=cint(current_page)
end if
if current_page>total_page then
current_page=total_page
elseif current_page<1 then
current_page=1
end if
current_page=total_page
elseif current_page<1 then
current_page=1
end if
adoRS.AbsolutePage=current_page
%>
<table border="0" align="center" cellspacing="1" cellpadding="3" bgcolor="#97C8EC" width="85%">
<tr bgcolor="#257BCB">
<td colspan="5" bgcolor="#257BCB">
<div align="left"><b><font color="#FFFFFF">文章列表</font></b></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="3%">
<div align="center"><b></b></div>
</td>
<td width="51%"><b> 标题</b></td>
<td width="16%"><b>上传时间 </b></td>
<td width="16%"><b>行业 </b></td>
<td width="30%"><b>状态</b></td>
</tr>
<%For jj = 1 to adoRS.PageSize%>
<%
pubdate = adoRS("pubdate")
pubyear = year(pubdate)
pubmonth = month(pubdate)
if pubmonth < 10 then
pubmonth = "0" & pubmonth
end if
pubday = day(pubdate)
if pubday < 10 then
pubday = "0" & pubday
end if
pubdatef = pubyear & "-" & pubmonth & "-" & pubday
%>
<tr bgcolor="#FFFFFF">
<td width="3%">
<div align="center">·</div>
</td>
<td bgcolor="#FFFFFF">
<%if adoRS("status")=2 or adoRS("status")=4 then%>
<a target="_blank" href="wz_yfbview.asp?id=<%=adoRS("id")%>"><%=adoRS("Title")%><span> </span></a>
<%else%>
<a target="_blank" href="wz_editor.asp?id=<%=adoRS("id")%>"><%=adoRS("Title")%><span> </span></a>
<%end if%>
</td>
<td width="16%"> [<%=pubdatef%>]</td>
<td width="16%"> <%=adoRS("industry")%></td>
<td width="30%">
<%
if adoRS("status")=0 then response.write "草稿"
if adoRS("status")=1 then response.write "待审核"
if adoRS("status")=2 then response.write "已发布"
if adoRS("status")=3 then response.write "已退回"
if adoRS("status")=4 then response.write "已删除"%>
</td>
</tr>
<%
adoRS.MoveNext
If adoRS.EOF Then Exit For
next
adoRS.close
%>
</table>
<br>
<table border="0" cellspacing="0" cellpadding="4" align="center" width=85% class=<%=tablestyle%>>
<tr>
<td width="661" colspan="3" bgcolor="#f0f0f0" class=<%=tablestyle%> >
<div align="center">
<p><font color="red">第<%=current_page%>页/总<%=total_page%>页
| 总<%=total_red%>条</font>
<%call showpage%>
转到第
<input type="text" name="goto_page1" value=<%=current_page%> size=3 style="border: 1px solid rgb(200,200,200)" maxlength=3>
页
<input style="height:19;WIDTH: 30px;border-left:1 ridge #ffffff;border-top:1 ridge #ffffff;border-bottom:1;border-right:1;border-style:ridge;background-color:#cccccc;"
class=<%=tablestyle%> hideFocus type="button" value="Go" name="cmd_goto" onClick="javascript:viewPage(document.all.goto_page1.value);">
</p>
</div>
</td>
</tr>
</table>
<script language="javascript">
function viewPage(ipage){
document.frm_page.me_page.value=ipage;
document.frm_page.submit();
}
</script>
<%
sub showpage() '显示分页导航条
n=total_page
if n>1 then
k=current_Page
if k=1 then
response.write " | <font color='#999999'>首页</font>"
response.write " | <font color='#999999'>上页</font>"
response.write " | <a href='javascript:viewPage(" & cstr(k+1) &")' language='javascript'>下页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(n) & ")' language='javascript'>尾页</a>"
elseif k=n then
response.write " | <a href='javascript:viewPage(" & cstr(1) & ")' language='javascript'>首页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k-1) & ")' language ='javascript'>上页</a>"
response.write " | <font color='#999999'>下页</font>"
response.write " | <font color='#999999'>尾页</font>"
else
response.write " | <a href='javascript:viewPage(" & cstr(1) & ")' language ='javascript'>首页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k-1) & ")' language ='javascript'>上页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k+1) &")' language ='javascript'>下页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(n) & ")' language ='javascript'>尾页</a>"
end if
%>
<table border="0" align="center" cellspacing="1" cellpadding="3" bgcolor="#97C8EC" width="85%">
<tr bgcolor="#257BCB">
<td colspan="5" bgcolor="#257BCB">
<div align="left"><b><font color="#FFFFFF">文章列表</font></b></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="3%">
<div align="center"><b></b></div>
</td>
<td width="51%"><b> 标题</b></td>
<td width="16%"><b>上传时间 </b></td>
<td width="16%"><b>行业 </b></td>
<td width="30%"><b>状态</b></td>
</tr>
<%For jj = 1 to adoRS.PageSize%>
<%
pubdate = adoRS("pubdate")
pubyear = year(pubdate)
pubmonth = month(pubdate)
if pubmonth < 10 then
pubmonth = "0" & pubmonth
end if
pubday = day(pubdate)
if pubday < 10 then
pubday = "0" & pubday
end if
pubdatef = pubyear & "-" & pubmonth & "-" & pubday
%>
<tr bgcolor="#FFFFFF">
<td width="3%">
<div align="center">·</div>
</td>
<td bgcolor="#FFFFFF">
<%if adoRS("status")=2 or adoRS("status")=4 then%>
<a target="_blank" href="wz_yfbview.asp?id=<%=adoRS("id")%>"><%=adoRS("Title")%><span> </span></a>
<%else%>
<a target="_blank" href="wz_editor.asp?id=<%=adoRS("id")%>"><%=adoRS("Title")%><span> </span></a>
<%end if%>
</td>
<td width="16%"> [<%=pubdatef%>]</td>
<td width="16%"> <%=adoRS("industry")%></td>
<td width="30%">
<%
if adoRS("status")=0 then response.write "草稿"
if adoRS("status")=1 then response.write "待审核"
if adoRS("status")=2 then response.write "已发布"
if adoRS("status")=3 then response.write "已退回"
if adoRS("status")=4 then response.write "已删除"%>
</td>
</tr>
<%
adoRS.MoveNext
If adoRS.EOF Then Exit For
next
adoRS.close
%>
</table>
<br>
<table border="0" cellspacing="0" cellpadding="4" align="center" width=85% class=<%=tablestyle%>>
<tr>
<td width="661" colspan="3" bgcolor="#f0f0f0" class=<%=tablestyle%> >
<div align="center">
<p><font color="red">第<%=current_page%>页/总<%=total_page%>页
| 总<%=total_red%>条</font>
<%call showpage%>
转到第
<input type="text" name="goto_page1" value=<%=current_page%> size=3 style="border: 1px solid rgb(200,200,200)" maxlength=3>
页
<input style="height:19;WIDTH: 30px;border-left:1 ridge #ffffff;border-top:1 ridge #ffffff;border-bottom:1;border-right:1;border-style:ridge;background-color:#cccccc;"
class=<%=tablestyle%> hideFocus type="button" value="Go" name="cmd_goto" onClick="javascript:viewPage(document.all.goto_page1.value);">
</p>
</div>
</td>
</tr>
</table>
<script language="javascript">
function viewPage(ipage){
document.frm_page.me_page.value=ipage;
document.frm_page.submit();
}
</script>
<%
sub showpage() '显示分页导航条
n=total_page
if n>1 then
k=current_Page
if k=1 then
response.write " | <font color='#999999'>首页</font>"
response.write " | <font color='#999999'>上页</font>"
response.write " | <a href='javascript:viewPage(" & cstr(k+1) &")' language='javascript'>下页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(n) & ")' language='javascript'>尾页</a>"
elseif k=n then
response.write " | <a href='javascript:viewPage(" & cstr(1) & ")' language='javascript'>首页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k-1) & ")' language ='javascript'>上页</a>"
response.write " | <font color='#999999'>下页</font>"
response.write " | <font color='#999999'>尾页</font>"
else
response.write " | <a href='javascript:viewPage(" & cstr(1) & ")' language ='javascript'>首页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k-1) & ")' language ='javascript'>上页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(k+1) &")' language ='javascript'>下页</a>"
response.write " | <a href='javascript:viewPage(" & cstr(n) & ")' language ='javascript'>尾页</a>"
end if
else
response.write " | <font color='#999999'>首页</font>"
response.write " | <font color='#999999'>上页</font>"
response.write " | <font color='#999999'>下页</font>"
response.write " | <font color='#999999'>尾页</font>"
end if
end sub
%>
<form action="wz_list.asp?author=<%=author%>" method=post name="frm_page">
<input type="hidden" name="me_page">
<input type="hidden" name="class" value=<%=myclass%>>
</form>
<%
else
response.write "<br><br><center><font color=red>没有该类信息!</font></center>"
end if
response.write " | <font color='#999999'>首页</font>"
response.write " | <font color='#999999'>上页</font>"
response.write " | <font color='#999999'>下页</font>"
response.write " | <font color='#999999'>尾页</font>"
end if
end sub
%>
<form action="wz_list.asp?author=<%=author%>" method=post name="frm_page">
<input type="hidden" name="me_page">
<input type="hidden" name="class" value=<%=myclass%>>
</form>
<%
else
response.write "<br><br><center><font color=red>没有该类信息!</font></center>"
end if
end if
%>
%>