急问:SOS ASP 分页!!!

renlily 2004-08-03 11:02:29
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<TITLE></TITLE>
<SCRIPT language="javascript">
function PageFirst()
{
document.MyForm.CurrentPage.selectedIndex=0;
document.MyForm.CurrentPage.onchange();
}
function PagePrior()
{
document.MyForm.CurrentPage.selectedIndex--;
document.MyForm.CurrentPage.onchange();
}
function PageNext()
{
document.MyForm.CurrentPage.selectedIndex++;
document.MyForm.CurrentPage.onchange();
}
function PageLast()
{
document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
document.MyForm.CurrentPage.onchange();
}

function PageCurrent()
{
document.MyForm.action='newpage.asp?Page='+(document.MyForm.CurrentPage.selectedIndex+1);
document.MyForm.submit();
}
</SCRIPT>
</HEAD>
<BODY bgcolor="#ffffcc">
<%
dim StrConn,Conn
set Conn=server.CreateObject ("adodb.connection")
StrConn = "driver={SQL Server};server=(local);UID=sa;PWD=;database=wpos"
Conn.Open strConn
set rs =server.CreateObject ("adodb.recordset")
'rs.CursorLocation = adUseClient
rs.PageSize = 4
sql="SELECT USER_ID, USER_MEI, MAIL FROM M_USER"
rs.Open sql,conn,3,2
if rs.EOF then
Response.Write ("<font size=2 color=#000080>[there is no data!]</font>")
else
if Request("Currentpage") = "" then
rs.AbsolutePage = 1
else
rs.AbsolutePage = Clng(Request("CurrentPage"))
Response.Write rs.AbsolutePage
Response.End
end if
if rs.PageCount = 1 then
Response.Write ("[First] [Pre] [Next] [Last]")
else
if rs.AbsolutePage = 1 then
Response.Write ("[First] [Pre]")
Response.Write ("[<a href=javascript:PageNext()>Next</a>]")
Response.Write ("[<a href=javascript:PageLast()>Last</a>]")
else
if rs.AbsolutePage = rs.PageCount then
Response.Write ("[Next] [Last]")
Response.Write ("[<a href=javascript:PageFirst()>First</a>]")
Response.Write ("[<a href=javascript:PagePrior()>Pre</a>]")
else
Response.Write ("[<a href=javascript:PageFirst()>First</a>]")
Response.Write ("[<a href=javascript:PagePrior()>Pre</a>]")
Response.Write ("[<a href=javascript:PageNext()>Next</a>]")
Response.Write ("[<a href=javascript:PageLast()>Last</a>]")
end if
end if
end if
'''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write("NO: <select size=1 name=CurrentPage onchange=PageCurrent()>")
for i=1 to rs.PageCount
if rs.AbsolutePage = i then
Response.Write("<option selected>"&i&"</option>")
else
Response.Write ("<option>"&i&"</option>")
end if
next
Response.Write ("</select>page total"&rs.PageCount&" page total "&rs.RecordCount&" piece note </font></p>")
Response.Write ("</form> ")
end if
Response.Write ("<table align=center border=1 cellspacing=1 cellpaddding=1 ")
Response.Write ("bordercolor=#99ccff>")
Response.Write ("<tr bgcolor=#ccccff bordercolor=#000066>")
for i=0 to rs.Fields.Count-1
Response.Write ("<td align=center width=200 height=13>")
Response.Write ("<font size=2>"&rs.Fields(i).Name&"</font></td>")
next
Response.Write ("</tr>")
for i=1 to rs.PageSize
Response.Write ("<tr bgcolor=#99ccff bordercolor=#000066>")
for j=0 to rs.Fields.Count-1
Response.Write ("<td><font size=2>"&rs.Fields(j).Value&"</font></td>")
next
Response.Write("</tr>")
rs.MoveNext
if rs.EOF then exit for
next
Response.Write ("</table>")

%>
</BODY>
</HTML>
昨天大家告诉我的分页代码,不好用,帮忙看看!!!
...全文
45 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
sunjiujiu 2004-08-03
if rs.EOF then
Response.Write ("<font size=2 color=#000080>[there is no data!]</font>")
else
if Request("Currentpage") = "" then
rs.AbsolutePage = 1
else
rs.AbsolutePage = Clng(Request("CurrentPage"))
Response.Write rs.AbsolutePage
Response.End
end if
-----

你这里的response.end干什么,给结束了,其它的还怎么显示啊?
把这句去掉
回复
breakshow 2004-08-03
晕,楼主这里是帮你解决问题的,可不是帮你写程序的.
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-03 11:02
社区公告
暂无公告