| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 468 人关注过本帖
标题:[求助]分頁程序,請高手幫幫忙!
取消只看楼主 加入收藏
ldzlh
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2005-12-26
收藏
 问题点数:0 回复次数:1 
[求助]分頁程序,請高手幫幫忙!
下面代碼是一個分頁程序,請高手幫幫忙,怎么把點ENTER進入指定頁。改成直接選取後進入指定頁,在線等,謝謝!
<%
sql="select * from weix order by weix_id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>暫時沒有信息!</p>"
else
totalPut=rs.recordcount
TotalPage = RS.PageCount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
end if
end if
rs.close
end if

set rs=nothing
sub showContent
dim i
i=0

%>
.......
<%
end sub

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action='index.asp?user="&username&"'>"
response.write "<p align='center' vAlign='bottom'>"
if CurrentPage<2 then
response.write "<font color='999966'>首頁 上一頁</font> "
else
response.write "<a href="&filename&"?page=1&typename="&typename&"&keyword="&keyword&">首頁</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&typename="&typename&"&keyword="&keyword&">上一頁</a> "
end if
if n-currentpage<1 then
response.write "<font color='999966'>下一頁 尾頁</font>"
else
response.write "<a href="&filename&"?page="&CurrentPage+1&"&typename="&typename&"&keyword="&keyword&">下一頁</a> "
response.write "<a href="&filename&"?page="&n&"&typename="&typename&"&keyword="&keyword&">尾頁</a>"
end if
response.write " 頁次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>頁 "
response.write " 共<b>"&totalnumber&"</b>條信息<b>"&maxperpage&"</b>條信息/頁"
response.write " 轉到:"
%>
<select name="Page" <% if totalpage = 0 then Response.Write("disabled")%> size=1 class=smallselsect style="BACKGROUND-COLOR:#BBE3FF;font-family: verdana; font-size:7pt;">
<% for I = 1 to n %>
<option value="<%=I%>" <% if I = CInt(CurrentPage) then Response.write("selected") end if %>><%=I%></option>
<% Next %>
</select>
<%
response.write " <input class=buttonface type='submit' value='ENTER' name='cndok' style='border: 1px #333333 solid; background-color: #BBE3FF; font-family:verdana; font-size: 7pt;'></span></p></form>"
end function
%>
2005-12-26 19:47
ldzlh
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2005-12-26
收藏
得分:0 
高手們來幫幫忙啊,很急的!謝謝了!

2005-12-26 19:55
快速回复:[求助]分頁程序,請高手幫幫忙!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.046038 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved