2006-4-30 作者: 来源:互联网 点击:1352
asp编程技术,ASP实现对新闻的分页例子
实现对新闻的分页例子,源代码如下:
<table>
<%
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 "<tr>" & vbCrlf
Response.Write "<td width=120 align=left bgcolor=#538E7B> </td>" & vbCrlf
Response.Write "<td width=80% bgcolor=#95D2FF>對不起,還沒有----相應的數據</span>" & vbCrlf
Response.Write "</td></tr>" & 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 "<tr>" & vbCrlf
Response.Write "<td width=120 align=left bgcolor=#C0DAD1>" & Trdate & " </td>" & vbCrlf
Response.Write "<td width=80% bgcolor=#e4e4e4 height=20>" & vbCrlf
Response.Write "<a href=""javascript:goto_jump(" & Rs("id") & "‚" & Rs("trdate") & "‚"" &
Rs("Newscode") & ""‚" & Rs("Identity") & ")""> " & vbCrlf
Response.Write Rs("HeadLine") & "</a></td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
Rs.MoveNext
If Rs.EOF Then Exit For
next
Response.Write "<tr>" & vbCrlf
Response.Write "<td align=right colspan=3 bgcolor=#99cccc>" & vbCrlf
if page <>1 then
Response.Write "<a href=relnews.asp?page=1&itemcode="&strCode&">首頁</a>" & vbCrlf
end if
tmppage = page - 1
if tmppage <= 0 then
tmppage = 1
else
Response.Write"<a href=relnews.asp?page="&tmppage&"&itemcode="&strCode&">上一頁</a>"& vbCrlf
end if
tmppage = page + 1
if tmppage > Rs.PageCount then
tmppage = page
else
Response.Write "<a href=relnews.asp?page="&tmppage&"&itemcode="&strCode&">下一頁</a>"&vbCrlf
end if
if Cstr(page) <> Cstr(Rs.PageCount) then
Response.Write "<a href=relnews.asp?page="&Rs.PageCount&"&itemcode="&strCode&">尾頁</a>&vbCrlf
end if
Response.Write "<font color:#ccffcc">第" & page & "頁</font> "
Response.Write "<font color:#ccffcc">總共有:" & Rs.PageCount & " 頁</font>" & 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"></td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
end if
%>
</table>
<table>
<%
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 "<tr>" & vbCrlf
Response.Write "<td width=120 align=left bgcolor=#538E7B> </td>" & vbCrlf
Response.Write "<td width=80% bgcolor=#95D2FF>對不起,還沒有----相應的數據</span>" & vbCrlf
Response.Write "</td></tr>" & 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 "<tr>" & vbCrlf
Response.Write "<td width=120 align=left bgcolor=#C0DAD1>" & Trdate & " </td>" & vbCrlf
Response.Write "<td width=80% bgcolor=#e4e4e4 height=20>" & vbCrlf
Response.Write "<a href=""javascript:goto_jump(" & Rs("id") & "‚" & Rs("trdate") & "‚"" &
Rs("Newscode") & ""‚" & Rs("Identity") & ")""> " & vbCrlf
Response.Write Rs("HeadLine") & "</a></td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
Rs.MoveNext
If Rs.EOF Then Exit For
next
Response.Write "<tr>" & vbCrlf
Response.Write "<td align=right colspan=3 bgcolor=#99cccc>" & vbCrlf
if page <>1 then
Response.Write "<a href=relnews.asp?page=1&itemcode="&strCode&">首頁</a>" & vbCrlf
end if
tmppage = page - 1
if tmppage <= 0 then
tmppage = 1
else
Response.Write"<a href=relnews.asp?page="&tmppage&"&itemcode="&strCode&">上一頁</a>"& vbCrlf
end if
tmppage = page + 1
if tmppage > Rs.PageCount then
tmppage = page
else
Response.Write "<a href=relnews.asp?page="&tmppage&"&itemcode="&strCode&">下一頁</a>"&vbCrlf
end if
if Cstr(page) <> Cstr(Rs.PageCount) then
Response.Write "<a href=relnews.asp?page="&Rs.PageCount&"&itemcode="&strCode&">尾頁</a>&vbCrlf
end if
Response.Write "<font color:#ccffcc">第" & page & "頁</font> "
Response.Write "<font color:#ccffcc">總共有:" & Rs.PageCount & " 頁</font>" & 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"></td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
end if
%>
</table>
声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。如有疑问请与站长联系。
相关链接更多...
- ASP对Cookies操作的详细介绍2006-4-30
- ASP实现随机提取数据库记录例程2006-4-30
- ASP实现QQ式的信息收发功能2006-4-30
- ASP控制数字及字母输入2006-4-30
- ASP接收Cookies的实例2006-4-30
- ASP实现对新闻的分页例子2006-4-30
- 浅谈自动采集程序及入库2006-4-30
- asp实现上一篇下一篇2006-4-30
- javascript分割字符串2006-4-30
- 仿网易新闻的“头图新闻”的图片转换效果2006-4-30
网友评论
目前没有评论!
全站精华
- 塑造完美—最美丽的CG女孩 [图]
- Trapped 精彩插画作品(3)[图]
- Trapped 精彩插画作品(2)[图]
- Trapped 精彩插画作品(1)[图]
- Trapped 精彩插画作品(1)[图]
- 韩国插画小品(3)[图]
- 韩国插画小品(1)[图]
- 乡村树花草摄影作品[图]
- 香港顶尖室内设计师梁志天作品[图]
- 天使的嫁衣--婚纱装欣赏[图]
- 经典样本设计欣赏(国人作品)3[图]
- 经典样本设计欣赏(国人作品)2[图]
- 经典样本设计欣赏(国人作品)1[图]
- 张洪科广告设计欣赏(3)[图]
- 张洪科广告设计欣赏(2)[图]
- MIKE H的CG插画作品欣赏(1)[图]
- MIKE H的CG插画作品欣赏(2)[图]
- MIKE H的CG插画作品欣赏(3)[图]
- 韩国品牌YSB夏装 冷艳美人异国风情(3)[图]
- asp远程图片自动上传到服务器
- 人像摄影:《炫影》(1)[图]
- 人像摄影:《炫影》(2)[图]
- 人像摄影:《炫影》(3)[图]
- 景观设计城市公园:浙江黄岩永宁公园(3)[图]
- 朱峰手绘插画-角色篇(Characters)(一)[图]
- 朱峰手绘插画-角色篇(Characters)(十三)[图]
- 朱峰手绘插画欣赏--场景篇(Environments)(1)[图]
- 经典室内设计作品--宫殿风格1[图]
- 地产广告1[图]
- 《星战》原版手绘作品欣赏--电影中看不到的经典[图]
图文精彩
![经典样本设计欣赏(国人作品)1[图]--平面广告](http://www.fansart.com/uploadfile/200642664631465.jpg)
【2006-4-26 17:57:18】
经典样本设计欣赏(国人作品)1
经典样本设计欣赏(国人作品)1

【2006-4-26 14:27:13】
新锐CG插画 Monday to Friday
新锐CG插画 Monday to Friday

【2006-4-26 13:34:46】
Natascha Roeoesli的人物CG插画作品欣赏(1)
Natascha Roeoesli的人物CG插画作品欣赏(1)
![水木清华地产广告欣赏[图]--平面广告](http://www.fansart.com/uploadfile/200642634295921.jpg)
【2006-4-26 9:31:54】
水木清华地产广告欣赏
水木清华地产广告欣赏
![2006夏日流行时尚,创意无限街头华丽[图]--时装魅影](http://www.fansart.com/uploadfile/200642261089093.jpg)
【2006-4-22 16:46:51】
2006夏日流行时尚,创意无限街头华丽
2006夏日流行时尚,创意无限街头华丽
![万科西山庭院.格.沉.尊[图]--平面广告](http://www.fansart.com/uploadfile/200642133015939.jpg)
【2006-4-21 9:08:35】
万科西山庭院.格.沉.尊
万科西山庭院.格.沉.尊
![泊林花园推广故事绘本(2)[图]--CG插画](http://www.fansart.com/uploadfile/200642042197577.jpg)
【2006-4-20 11:43:23】
泊林花园推广故事绘本(2)
泊林花园推广故事绘本(2)
![泊林花园推广故事绘本(1)[图]--CG插画](http://www.fansart.com/uploadfile/200642041664949.jpg)
【2006-4-20 11:34:33】
泊林花园推广故事绘本(1)
泊林花园推广故事绘本(1)
![房地产广告设计-之水墨风格1[图]--平面广告](http://www.fansart.com/uploadfile/200641457308753.jpg)
【2006-4-14 15:56:06】
房地产广告设计-之水墨风格1
房地产广告设计-之水墨风格1
![溯源居广告欣赏--小红人[图]--平面广告](http://www.fansart.com/uploadfile/200641453136345.jpg)
【2006-4-14 14:45:57】
溯源居广告欣赏--小红人
溯源居广告欣赏--小红人
![cg插画欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641433658593.jpg)
【2006-4-14 9:21:18】
cg插画欣赏
cg插画欣赏
![yashasi插画作品欣赏[图]--CG插画](http://www.fansart.com/uploadfile/200641366906025.jpg)
【2006-4-13 18:32:29】
yashasi插画作品欣赏
yashasi插画作品欣赏
![北邦插画欣赏(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641335800545.jpg)
【2006-4-13 9:49:02】
北邦插画欣赏(1)
北邦插画欣赏(1)
![高傲的玫瑰-温碧霞[图]--摄影艺术](http://www.fansart.com/uploadfile/200641232299455.jpg)
【2006-4-12 8:58:34】
高傲的玫瑰-温碧霞
高傲的玫瑰-温碧霞
![国粹京剧脸谱表情[图]--界面设计](http://www.fansart.com/uploadfile/200641164370797.jpg)
【2006-4-11 17:51:33】
国粹京剧脸谱表情
国粹京剧脸谱表情
![回忆紫禁城里那些逝去的[图]--中国艺术](http://www.fansart.com/uploadfile/200641159463469.jpg)
【2006-4-11 16:34:31】
回忆紫禁城里那些逝去的
回忆紫禁城里那些逝去的
![非常可爱的儿童插画(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641157447221.jpg)
【2006-4-11 15:59:16】
非常可爱的儿童插画(1)
非常可爱的儿童插画(1)

【2006-4-11 15:49:41】
荷兰著名画家Anton Pieck插画
荷兰著名画家Anton Pieck插画
![美国插画师kevindart作品[图]--CG插画](http://www.fansart.com/uploadfile/200641156355093.jpg)
【2006-4-11 15:37:32】
美国插画师kevindart作品
美国插画师kevindart作品
![美国插画师kevindart作品(1)[图]--CG插画](http://www.fansart.com/uploadfile/200641156499109.jpg)
【2006-4-11 15:34:43】
美国插画师kevindart作品(1)
美国插画师kevindart作品(1)