[求助]分頁程序,請高手幫幫忙!
下面代碼是一個分頁程序,請高手幫幫忙,怎么把點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
%>