分类分类
关注+2004-10-08作者:蓝点
实现对新闻的分页例子,源代码如下:
<%
strCode = Request.QueryString("itemcode")
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open Application("tt18_ConnectionString")
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql="select * from NewsHeadC where itemcode = ""&strCode&"" order by TrDate DESC,a.NewsTime DESC"
Rs.Open Sql,Conn,1,3
Rs.PageSize = 15
Count = Rs.PageCount
if Rs.BOF or Rs.EOF then
Response.Write "" & vbCrlf
Response.Write "
" & vbCrlf
Response.Write "
對不起,還沒有----相應的數據" & vbCrlf
Response.Write "
" & vbCrlf
else
Rs.AbsolutePage = page
for i = 1 to Rs.PageSize
Trdate = left(RS("trdate"),4) & "-" & mid(RS("trdate"),5,2) & "-" & right(RS("trdate"),2)
Response.Write "" & vbCrlf
Response.Write "
" & Trdate & " " & vbCrlf
Response.Write "
" & vbCrlf
Response.Write "<a href=""javascript:goto_jump(" & Rs("id") & "," & Rs("trdate") & ","" &
Rs("Newscode") & ""," & Rs("Identity") & ")""> " & vbCrlf
Response.Write Rs("HeadLine") & "" & vbCrlf
Response.Write "
" & vbCrlf
Rs.MoveNext
If Rs.EOF Then Exit For
next
Response.Write "" & vbCrlf
Response.Write "
" & vbCrlf
if page <>1 then
Response.Write "首頁" & vbCrlf
end if
tmppage = page - 1
if tmppage <= 0 then
tmppage = 1
else
Response.Write"上一頁"& vbCrlf
end if
tmppage = page + 1
if tmppage > Rs.PageCount then
tmppage = page
else
Response.Write "下一頁"&vbCrlf
end if
if Cstr(page) <> Cstr(Rs.PageCount) then
Response.Write "尾頁&vbCrlf
end if
Response.Write "第" & page & "頁 "
Response.Write "總共有:" & Rs.PageCount & " 頁" & vbCrlf
Response.Write "<INPUT type=button value=關閉窗口 name=button1 height=12 size=18
onclick="javascript:return window.close();" style="BACKGROUND-COLOR: beige; FONT-SIZE: smaller;
HEIGHT: 22px; WIDTH: 66px">" & vbCrlf
Response.Write "
" & vbCrlf
end if
%>
相关文章
更多+相同厂商
热门推荐
点击查看更多
点击查看更多
点击查看更多
说两句网友评论