<%'从这开始读数据
strSQL="Select * From web_news Order by ID Desc"
rs.open strSQL,conn,1,1
'分页显示初始化
page=GetVariable("page")
if page="" then
page=1
else
page=Cint(page)
end if
Section=GetVariable("section")
if Section="" then
Section=1
else
Section=Cint(Section)
end if
'变量赋值
intPageSize=15 '每页显示记录数
intSectionSize=5 '多少页为一段,像GOOGLE一样
PrevSectionText="<FONT face=webdings>7</FONT>" '上一段的链接文字
NextSectionText="<FONT face=webdings>8</FONT>" '下一段的链接文字
PrevPageText="<FONT face=webdings>3</FONT>" '上页的链接文字
NextPageText="<FONT face=webdings>4</FONT>" '下页的链接文字
strPageUrl="?"
rs.pagesize=intPageSize
intCount=rs.RecordCount
intPageCount=rs.pagecount
intSectionCount=(intPageCount - 1) \ intSectionSize + 1
if intCount>0 then
rs.AbsolutePage=page
end if
%>
<TABLE width="100%"
border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD><TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="65%" valign="top"><table width="96%" border="0" cellpadding="0" cellspacing="0">
<% '开始输出最新新闻
for i=1 to intPageSize
if rs.eof then exit For
if i mod 2 =0 then
strColor="#FFFFFF"
else
strColor="#eaeff6"
end if
%>
<tr>
<td height="30" style="border-bottom:1px #666666 dotted;"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td style="padding-right:8px;"><img src="images/c_ndian.gif" width="8" height="8"> <a href="newshow.asp?id=<%=trim(rs("ID"))%>" target="_blank"><%=trim(rs("nTitle"))%></a></td>
</tr>
</table></td>
<td width="80" align="center" style="border-bottom:1px #666666 dotted;">(<%=rs("nTime")%>)</td>
</tr>
<%
rs.movenext
next
end if
%>
</table></TD>
</TR>
<TR>
<TD height="25"> </TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right" style="border-top:#666666 solid 1px;"><%
if request.QueryString("tohtml")=1 then
response.Write "<pengta:pagelist>"
else%>
共有<%=intCount%>记录,分<%=intPageCount%>页,当前页<%=Page%>,每页显示<%=intPageSize%>条记录
<%
'计算每一段的开始页
intStarPage=(Section-2) * intSectionSize + 1
'前一段
if Section<=1 then
response.Write(PrevSectionText & " ")
else
response.Write("<a href='" & strPageUrl & "&page=" & intStarPage & "§ion=" & Section-1 & "'>" & PrevSectionText & "</a> ")
end if
'显示页码列表
response.Write("第")
intStarPage=(Section-1) * intSectionSize + 1
for p=intStarPage to intStarPage + intSectionSize - 1
if p > intPageCount then exit for
if p=page then
response.Write("<strong>[" & p & "]</strong> ")
else
response.Write("<a href='" & strPageUrl & "&page=" & p & "§ion=" & Section & "'>[" & p & "]</a> ")
end if
next
response.Write("页")
'后一段
intStarPage=(Section) * intSectionSize + 1
if Section>=intSectionCount then
response.Write(" " & NextSectionText)
else
response.Write(" <a href='" & strPageUrl & "&page=" & intStarPage & "§ion=" & Section+1 & "'>" & NextSectionText & "</a> ")
end if
%>
</td>
</tr>
</table>