关于分页的疑虑
两个文件
changban.asp
showpage.asp
文件.mdb
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="adovbs.inc"-->
<!--#include file="showpage.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>信息发布</title>
<style type="text/css">
<!--
.style2 {
color: #FFFFFF;
font-size: 14px;
font-weight: bold;
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-size: 10pt;
}
.style5 {color: #0000FF}
.style6 {font-size: 10pt}
.style7 {color: #0000FF; font-size: 10pt; }
-->
</style></head>
<!--记录集连接-->
<%
on error resume next
err.clear
dim strsql
dim rsfile
set rsfile=server.createobject("adodb.recordset"
strsql = "select * from 文件表"
'call openconn '打开连接
dim conn
dim connstr
dim db
db="文件.mdb"
'更改数据库名字
Set conn = Server.CreateObject("ADODB.Connection"
'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&""
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("文件.mdb"
conn.Open connstr
if err.number <> 0 then
response.write("<script>alert('与服务器连接不成功!');history.back();</script>"
err.clear
response.end
end if
rsfile.open strsql,conn
if err.number <> 0 then
response.write err.description
response.write("<script>alert('记录集获取不成功');history.back();</script>"
err.clear
response.end
end if
%></td>
</tr>
<!--以上为记录集获取代码-->
<body>
<div align="center">
<table width="756" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<!--页面部分-->
<tr>
<td width="756" height="100" valign="top"><div align="center"><img src="gif/head.gif" width="756" height="104"></div></td>
</tr>
</table>
</div>
<div align="center">
<table width="756" border="0" cellpadding="0" cellspacing="0">
<!--导航栏-->
<tr>
<div align="center">
<table width="756" height="266" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<!--主文件区-->
<tr valign="middle">
<td width="173" height="28" align="center" background="gif/yejiao2.gif" class="style5"><% response.Write(date()) %> </td>
<td valign="middle" background="gif/yejiao.gif"> <table cellspacing="0" cellpadding="0">
</table>
<div align="center"><a href="厂内文件.asp" class="style5 style6"> 厂办信息</a> | <a href="简报通知.asp" class="style7">生产管理</a> | <a href="生产计划.asp" class="style7">财务制度</a> | <a href="党政工团.asp" class="style5">党工<span class="style6"></span>活动</a> | <a href="车间在线.asp" class="style5">公司结算</a></div></td>
<td valign="middle" background="gif/yejiao.gif"><!--DWLayoutEmptyCell--> </td>
<td valign="middle" background="gif/yejiao.gif"><!--DWLayoutEmptyCell--> </td>
<td width="76" align="center" valign="top" background="gif/yejiao2.gif" bgcolor="#FFFFCC"><form name="form1" method="post" action="login.asp">
<div align="center"><input name="Submit" type="submit" class="font" value="管理员登陆"></form>
</td>
<tr valign="middle">
<tr>
<td height="72" colspan="5" valign="top">
<p align="center">
<div align="center"><form action="changban.asp" method="get">
<%
rsfile.pagesize=3
'rsfile.absolutepage=page
page=clng(request("page"
)
if page<1 then page=1
if page>rsfile.pagecount then page=rsfile.pagecount
showonepage rsfile,page
%>
<%
if page<>1 then
response.Write "<a href=changban.asp?page=1>第一页</a>"
response.Write " "
response.Write "<a href=changban.asp?page=" & (page-1) & ">上一页</a>"
end if
if page<>rsfile.pagecount then
response.Write " "
response.Write "<a href=changban.asp?page="& (page+1) &">下一页</a>"
response.Write " "
response.Write "<a href=changban.asp?page="& rsfile.pagecount &">最后一页</a>"
end if
%>
请输入页码:<input type="text" name=page size=2>
页码:<font color="red"><%=page%>/<% =rsfile.pagecount%></font>
</form>
</p>
</div>
</td>
</tr>
</table>
<div align="center">
<table width="756" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<!--页角编辑区-->
<tr>
<td width="756" height="19" valign="top" background="gif/yejiao.gif"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="37" align="center" valign="middle" bgcolor="#3300CC" class="style2">厂办2005年12月26日编辑</td>
</tr>
<tr>
<td height="19" valign="top" background="gif/yejiao2.gif"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</div>
</body>
</html>
showpage.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<% sub showonepage(rs,page) %>
<center><font size=19 color=#3300cc>高教厂文件查询系统</font></center><br>
<center><table border=1 width=100% >
<tr bgcolor="#00ffff">
<tr>
<td height="39" align="center"><b>文件编号</b></td>
<td width="355" align="center"><b>文件名</b></td>
<td width = "82" align="center"><b>录入人</b></td>
<td align="center" valign="middle"><div align="center"><b>发布时间</b></div></td>
<td align="center" valign="middle"><strong>是否有效</strong></td>
</tr>
<%
rs.absolutepage=page
for thepage=1 to rs.pagesize
response.Write "<tr>"
recnum =(page-1)*rs.pagesize+thepage
response.Write "<td> " & recnum & "</td>"
for i=0 to rs.fields.count-1 %>
<td><%=rs("文件编号"
.value%></td>
<td><%=rs("文件名"
.value%> </td>
<td><%=rs("录入人"
.value%></td>
<td><%=rs("发布时间"
.value%></td>
<td><%=rs("是否有效"
.value%></td>
<% next %> </tr>
<% rs.movenext
if rs.eof then exit for
next %>
</table></center>
<% end sub%>
</body>
</html>
页码显示不对