table分页(转)
<table width="100%" border="0" align="center" cellspacing="0" bgcolor="#006666">
<tr>
<td height="142" align="left" valign="top" bgcolor="#D9D9D9">
<table width="100%" height="76" border="0" align="center" cellspacing="0">
<tr>
<td height="72" valign="top">
<%
leixing="chengshijingguan"
set rs=server.createobject("adodb.recordset")
strl2="select * from diaosutu where leixing='"&leixing&"' order by riqi desc "
rs.open strl2,conn,3,2
%>
<%
if not rs.eof then
count=rs.recordcount
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=4
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
page_start=(pagecount-1)*rs.pagesize
if pagecount=1 then
page_start=1
end if
page_end=rs.pagesize*pagecount
if pagecount*rs.pagesize=>rs.recordcount then
page_end=rs.recordcount
end if
%>
<table width="100%">
<tr width="100%">
<%
i=0
do while not rs.eof
%>
<td valign="top" bgcolor="#D9D9D9">
<table width="180" border="0" align="center" cellspacing="1" bgcolor="#006666">
<tr>
<td width="174" bgcolor="#D2D8DF">
<div align="center">
<%Response.Write("<img src='tupian/diaosu/"&rs("mingcheng")&"'>")%>
</div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("chenghu")%>-<%=rs("dizhi")%></div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("caizhi")%>-<%=rs("chicun")%></div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("jianjie")%></div></td>
</tr>
</table></td>
<%
i=i+1
if i>=rs.pagesize then exit do
if i mod 2 =0 then
response.write "</tr>"
end if
rs.movenext
loop
%>
<% response.write "共搜索到"&count&"条图片信息"
response.write"<form name=form1 method=Post action='DS_CP_CSJG.asp?"+"&speciality="+speciality+"'>"
response.write "<font color='#000064'>◆ </font>"
if pagecount=1 then
response.write "<font color='#000064'>首页 上一页</font> "
else
response.write "<a href=DS_CP_CSJG.asp?page=1><font color='0000BE'>首页</font></a> "
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(pagecount-1)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>上一页</font></a> "
end if
if rs.PageCount-pagecount<1 then
response.write "<font color='#000064'>下一页 尾页</font>"
else
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(pagecount+1)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>下一页</font></a> "
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(rs.PageCount)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>尾页</font></a>"
end if
response.write "<font color='000064'> 页次:<font color=blue>"&pagecount&"</font>/"&rs.pagecount&"页</font>"
response.write "<font color='000064'> 转到第<input type='text' name='page' size=2 maxLength=3 style='font-size: 9pt; color:#00006A; position: relative; height: 18' value="&PageCount&">页</font> "
response.write "<input class=button type='submit' value='确 定' style='font-family: 宋体; font-size: 9pt; color: #000073; position: relative; height: 19'>"
response.write "</form>"
%>
<% end if %>
</table></td>
</tr>
</table>
<table width="83%" border="0" align="center" cellspacing="0">
<tr>
<td height="20"> <font size="2">
<%
rs.close
set rs = nothing
%>
</font> </td>
</tr>
</table></td>
</tr>
</table>
<tr>
<td height="142" align="left" valign="top" bgcolor="#D9D9D9">
<table width="100%" height="76" border="0" align="center" cellspacing="0">
<tr>
<td height="72" valign="top">
<%
leixing="chengshijingguan"
set rs=server.createobject("adodb.recordset")
strl2="select * from diaosutu where leixing='"&leixing&"' order by riqi desc "
rs.open strl2,conn,3,2
%>
<%
if not rs.eof then
count=rs.recordcount
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=4
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
page_start=(pagecount-1)*rs.pagesize
if pagecount=1 then
page_start=1
end if
page_end=rs.pagesize*pagecount
if pagecount*rs.pagesize=>rs.recordcount then
page_end=rs.recordcount
end if
%>
<table width="100%">
<tr width="100%">
<%
i=0
do while not rs.eof
%>
<td valign="top" bgcolor="#D9D9D9">
<table width="180" border="0" align="center" cellspacing="1" bgcolor="#006666">
<tr>
<td width="174" bgcolor="#D2D8DF">
<div align="center">
<%Response.Write("<img src='tupian/diaosu/"&rs("mingcheng")&"'>")%>
</div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("chenghu")%>-<%=rs("dizhi")%></div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("caizhi")%>-<%=rs("chicun")%></div></td>
</tr>
<tr>
<td bgcolor="#D2D8DF">
<div align="center"><%=rs("jianjie")%></div></td>
</tr>
</table></td>
<%
i=i+1
if i>=rs.pagesize then exit do
if i mod 2 =0 then
response.write "</tr>"
end if
rs.movenext
loop
%>
<% response.write "共搜索到"&count&"条图片信息"
response.write"<form name=form1 method=Post action='DS_CP_CSJG.asp?"+"&speciality="+speciality+"'>"
response.write "<font color='#000064'>◆ </font>"
if pagecount=1 then
response.write "<font color='#000064'>首页 上一页</font> "
else
response.write "<a href=DS_CP_CSJG.asp?page=1><font color='0000BE'>首页</font></a> "
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(pagecount-1)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>上一页</font></a> "
end if
if rs.PageCount-pagecount<1 then
response.write "<font color='#000064'>下一页 尾页</font>"
else
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(pagecount+1)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>下一页</font></a> "
response.write "<a href=DS_CP_CSJG.asp?page="+cstr(rs.PageCount)+"&name="+name+"&corpname="+corpname+"&homeplace="+homeplace+"&speciality="+speciality+"><font color='0000BE'>尾页</font></a>"
end if
response.write "<font color='000064'> 页次:<font color=blue>"&pagecount&"</font>/"&rs.pagecount&"页</font>"
response.write "<font color='000064'> 转到第<input type='text' name='page' size=2 maxLength=3 style='font-size: 9pt; color:#00006A; position: relative; height: 18' value="&PageCount&">页</font> "
response.write "<input class=button type='submit' value='确 定' style='font-family: 宋体; font-size: 9pt; color: #000073; position: relative; height: 19'>"
response.write "</form>"
%>
<% end if %>
</table></td>
</tr>
</table>
<table width="83%" border="0" align="center" cellspacing="0">
<tr>
<td height="20"> <font size="2">
<%
rs.close
set rs = nothing
%>
</font> </td>
</tr>
</table></td>
</tr>
</table>