我在使用ASP查询数据库后,分页显示第一页能正常显示,但是以后的页中都没有原来的CSS样式表了,表格的宽高属性也都没有了.本人刚刚学习ASP,望有高人指点.
网页的代码如下:
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data/mdata.mdb")
exec="select * from lx "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
rs.PageSize=3
pagecount=rs.PageCount
page=int(request.QueryString ("page"))
if page<=0 then page=1
if request.QueryString("page")="" then
page=1
end if
rs.AbsolutePage=page
%>
<table width="748" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>歌曲名</td>
<td>演唱者</td>
<td>添加日期</td>
</tr>
<%for i=1 to rs.PageSize%>
<%if rs.EOF then
exit for
end if%>
<tr>
<td><a href="lx-player.asp?tab=<%=rs("tab")%>"><%=rs("mname")%></a></td>
<td><%=rs("singer")%></td>
<td><%=rs("time")%></td>
</tr>
<%rs.movenext
next
%><tr>
<td colspan=3 align=right>
<%if page=1 and not page=pagecount then%>
<div align="right">第<%=page%>页 <%for i=1 to pagecount%>
<a href="q-list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="q-list.asp?page=<%=page+1%>">下一页</a> </div>
<%elseif page=pagecount and not page=1 then%>
<div align="right">第<%=page%>页 <%for i=1 to pagecount%>
<a href="q-list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="q-list.asp?page=<%=page-1%>">上一页</a> </div>
<%elseif page<1 then%><div class="font" align="right"><font color=red>没有任何记录!</font></div>
<%elseif page>pagecount then%><div class="font" align="right"><font color=red>没有任何记录!</font></div>
<%elseif page=1 and page=pagecount then%>
<%else%>
<div align="right">第<%=page%>页 <%for i=1 to pagecount%>
<a href="q-list.asp?page=<%=i%>"><%=i%></a> <%next%><a href="q-list.asp?page=<%=page-1%>">上一页</a>
<a href="q-list.asp?page=<%=page+1%>">下一页</a> </div>
<%end if%>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>