?? showpage.asp
字號(hào):
<%
'***********************************************
'函數(shù)名:PasteURL
'作 用:向地址中加入 ? 或 &
'參 數(shù):strUrl ----網(wǎng)址
'返回值:加了 ? 或 & 的網(wǎng)址
'***********************************************
function PasteURL(strUrl)
if strUrl="" then
PasteURL=""
exit function
end if
'如果傳入的URL末尾不是"?",有兩種情況:
'1.無(wú)“?”,此時(shí)需加入一個(gè)“?”
'2. 有“?”再判斷有無(wú)“&”
if InStr(strUrl,"?")<len(strUrl) then
if InStr(strUrl,"?")>1 then
if InStr(strUrl,"&")<len(strUrl) then
PasteURL=strUrl & "&"
else
PasteURL=strUrl
end if
else
PasteURL=strUrl & "?"
end if
else
PasteURL=strUrl
end if
end function
'***********************************************
'過(guò)程名:ShowPage
'作 用:顯示“上一頁(yè) 下一頁(yè)”等信息
'參 數(shù):sDesURL ----鏈接地址,可以是一個(gè)文件名,也可以是一個(gè)有一些參數(shù)所URL
' nTotalNumber ----總數(shù)量
' nMaxPerPage ----每頁(yè)數(shù)量
' nCurrentPage ----當(dāng)前頁(yè)
' bShowTotal ----是否顯示總數(shù)量
' bShowCombo ---是否用下拉列表顯示所有頁(yè)面以供跳轉(zhuǎn)。有某些頁(yè)面不能使用,否則會(huì)出現(xiàn)JS錯(cuò)誤。
' sUnit ----計(jì)數(shù)單位
'***********************************************
sub ShowPage(sDesURL, nTotalNumber, nMaxPerPage, nCurrentPage, bShowTotal, bShowCombo, sUnit)
dim n, i,strTemp,strUrl
'計(jì)算頁(yè)數(shù)
if nTotalNumber mod nMaxPerPage=0 then
n= nTotalNumber \ nMaxPerPage
else
n= nTotalNumber \ nMaxPerPage+1
end if
'判斷nCurrentPage
if nCurrentPage < 1 then
nCurrentPage = 1
elseif nCurrentPage > n then
nCurrentPage = n
end if
Response.Write "<table align='center' ID='Table1'><form name='ShowPages' method='Post' action='" & sDesURL & "' ID='Form1'><tr><td>"
if bShowTotal=true then
Response.Write "共 <b>" & nTotalNumber & "</b> " & sUnit & " "
end if
'根據(jù)輸入的sDesURL向它加入?或&
strUrl=PasteURL(sDesURL)
if nCurrentPage<2 then
Response.Write "首頁(yè) 上一頁(yè) "
else
Response.Write "<a href='" & strUrl & "page=1'>首頁(yè)</a> "
Response.Write "<a href='" & strUrl & "page=" & (nCurrentPage-1) & "'>上一頁(yè)</a> "
end if
if n-nCurrentPage<1 then
Response.Write "下一頁(yè) 尾頁(yè)"
else
Response.Write "<a href='" & strUrl & "page=" & (nCurrentPage+1) & "'>下一頁(yè)</a> "
Response.Write "<a href='" & strUrl & "page=" & n & "'>尾頁(yè)</a>"
end if
Response.Write " 頁(yè)次:<strong><font color=red>" & nCurrentPage & "</font>/" & n & "</strong>頁(yè) "
if bShowCombo=True then
Response.Write " 轉(zhuǎn)到:<SELECT name='page' size='1' onchange='javascript:submit()' ID='Select1'>"
for i = 1 to n
Response.Write "<option value='" & i & "'"
if cint(nCurrentPage)=cint(i) then Response.Write " selected "
Response.Write ">第" & i & "頁(yè)</option>"
next
Response.Write "</SELECT>"
end if
Response.Write "</td></tr></form></table>"
end sub
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -