<%
'数据库信息动态分页显示(asp版)
'程序编制:时代互联网服务中心
'网址:http://www.9816.net
'编制人:薛振山
'电话:13165263708
'邮箱:xzs0001@163.com
'欢迎大家批评指正
'请引用时保留此版权项
%>
<!--#include file="conn.asp"-->
<link rel="stylesheet" type="text/css" href="css/css.css">
<%
dim danyuangeshu,xiandingzishu,method,pageno,htmlname,fengese,yemase,fengekuandu
dim i
dim lieshu,hangshu
'ee为输出数据
method=Request.QueryString("method")
pageno=Request("pageno")
htmlname="?method=" & method & "¤tPage=" & currentPage & "&id=" & id & "&"
lieshu=1'--------------------组数
hangshu=20'------------------显示条数
danyuangeshu=3 '-------------栏目数(单元格数)
xiandingzishu=50 '-----------限定字数
fengese=content '-----------分隔色
yemase="#0000ff" '----------页码色
fengekuandu=30 '-------------分隔宽度
set rs=server.CreateObject("ADODB.Recordset")
sql="select * from news"
rs.Open sql,conn,1,1
rs.PageSize=lieshu*hangshu
if pageno="" then
pageno=1
else
pageno=cint(pageno)
end if
if rs.PageCount > 0 then rs.AbsolutePage=pageno
%>
<table border="0" cellpadding="2" style="border-collapse: collapse">
<tr>
<% for i=1 to lieshu %>
<td height="20" bgcolor="#C0C0C0" align="center">信息标题</td>
<td height="20" bgcolor="#C0C0C0" align="center">日期</td>
<td height="20" bgcolor="#C0C0C0" align="center" <% if i < cint(lieshu ) then %> style="border-right: <%=fengekuandu%>px solid <%=fengese%>"<% end if %>>拼音</td>
<% next %>
</tr>
<%
i=1
do while i<= hangshu and not rs.EOF
%>
<tr>
<%
for j=1 to lieshu
if not rs.EOF then
%>
<td align="left" height="20" onmousemove=bgColor="<%=linkge%>" onmouseout=bgColor=""><a target="_blank" title="<%=rs("newsname")%>" href="news_list.asp?id=<%=rs("id")%>"><% zishu rs("newsname"),12,"333333",xiandingzishu '(字串,字号,字色,字数)%></a></td>
<td align="center" height="20" onmousemove=bgColor="<%=linkge%>" onmouseout=bgColor=""><% formatshijian4 rs("adddate"),0,4'时间,有无时分,年份位数%></td>
<td align="left" onmousemove=bgColor="<%=linkge%>" onmouseout=bgColor="" height="20"<% if j < cint(lieshu ) then %> style="border-right: <%=fengekuandu%>px solid <%=fengese%>"<% end if %>><% zishu rs("pinyin"),12,"333333",xiandingzishu '(字串,字号,字色,字数)%></td>
<%
rs.MoveNext
else
%>
<td colspan="<%=danyuangeshu%>" <% if j < cint(lieshu ) then %> style="border-right: <%=fengekuandu%>px solid <%=fengese%>"<% end if %>></td>
<%
end if
next
%>
</tr>
<%
i=i+1
loop
%>
<tr>
<td colspan="<%=danyuangeshu * lieshu%>" align="center" height="30">
<%
if pageno > 1 then
%>
<a href="<%=htmlname%>pageno=1"><img border="0" src="images/fenyell.gif" width="8" height="12" alt="首页(1)"></a>
<a href="<%=htmlname%>pageno=<%=pageno-1%>"><img border="0" src="images/fenyeleft.gif" width="7" height="12" alt="前一页"></a>
<%
end if
if pageno > 5 then response.write "..."
for i=pageno-4 to pageno+4
if i > 0 and i <= rs.PageCount then
if clng(pageno)=i then
response.write ""
response.write "<a href='" & htmlname &"pageno=" & i & "'> <font color='"&yemase&"'><b>" & i & " </b></font></a>"
else
response.write "<a href='" & htmlname &"pageno=" & i & "'> " & i & " </a>"
end if
end if
next
'if pageno < rs.PageCount-4 and pageno > 1 then response.write "..."
if pageno < rs.PageCount-4 then response.write "..."
if pageno < rs.PageCount then
%>
<a href="<%=htmlname%>pageno=<%=pageno+1%>"><img border="0" src="images/fenyeright.gif" width="7" height="12" alt="后一页"></a>
<a href="<%=htmlname%>pageno=<%=rs.PageCount%>"><img border="0" src="images/fenyerr.gif" width="8" height="12" alt="末页(<%=rs.PageCount%>)"></a>
<%end if%>
<font color="#666666">
<span style="font-size: 12px">找到相关结果共 <%=rs.RecordCount%> 条(<%=rs.PageCount%>页)</span></font>
</td>
</tr>
</table>