分页遇到的问题?
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("yonghope.mdb")
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from news "
rs.open sql,conn,3
rs.pagesize=2
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
%>
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#0000FF" width="80%" align="center">
<tr bgcolor="#FFFFFF" align="center">
<th><%=rs(0).name%></th><th><%=rs(1).name%></th><th><%=rs(2).name%></th>
</tr>
<%
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
%>
<tr bgcolor="#FFFFFF" align="center">
<td><%=rs(0).value%></td><td><%=rs(1).value%></td><td><%=rs(2).value%></td>
</tr>
<%
rs.movenext()
next
%>
</table>
<p align="center">
<a href="index.asp?page=1">首页</a>
<a href="index.asp?page=<%=epage-1%>">前一页</a>
<a href="index.asp?page=<%=epage+1%>">后一页</a>
<a href="index.asp?page=<%=rs.pagecount%>">末页</a>
</p>
转到第
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<% for i = 1 to rs.PageCount %>
<% if i = epage then %>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%else%>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%end if %>
<%next%>
</select>页
<p align="center">现在是第<%=epage%>页一共有<%=rs.pagecount%>页</p>
<%
conn.close()
%>
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("yonghope.mdb")
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from news "
rs.open sql,conn,3
rs.pagesize=2
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
%>
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#0000FF" width="80%" align="center">
<tr bgcolor="#FFFFFF" align="center">
<th><%=rs(0).name%></th><th><%=rs(1).name%></th><th><%=rs(2).name%></th>
</tr>
<%
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
%>
<tr bgcolor="#FFFFFF" align="center">
<td><%=rs(0).value%></td><td><%=rs(1).value%></td><td><%=rs(2).value%></td>
</tr>
<%
rs.movenext()
next
%>
</table>
<p align="center">
<a href="index.asp?page=1">首页</a>
<a href="index.asp?page=<%=epage-1%>">前一页</a>
<a href="index.asp?page=<%=epage+1%>">后一页</a>
<a href="index.asp?page=<%=rs.pagecount%>">末页</a>
</p>
转到第
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<% for i = 1 to rs.PageCount %>
<% if i = epage then %>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%else%>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%end if %>
<%next%>
</select>页
<p align="center">现在是第<%=epage%>页一共有<%=rs.pagecount%>页</p>
<%
conn.close()
%>
在测试过程中,发现在, 转到第多少页的时候,就是这里。
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<% for i = 1 to rs.PageCount %>
<% if i = epage then %>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%else%>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%end if %>
<%next%>
</select>页
在前台,第一页不能显示,在后面的页调用成功。
还在前台总是显示1,在我选择第二页时,内容传过来了,但是在<select>里总是显示为1;
点1时,跳不过来。。。
不知道是什么原因????