ShowPage 顯示“上一頁(yè) 下一頁(yè)”等信息的封裝代碼
更新時(shí)間:2007年09月01日 22:20:54 作者:
'**************************************************
'函數(shù)名:ShowPage
'作 用:顯示“上一頁(yè) 下一頁(yè)”等信息
'參 數(shù):sFileName ----鏈接地址
' TotalNumber ----總數(shù)量
' MaxPerPage ----每頁(yè)數(shù)量
' ShowTotal ----是否顯示總數(shù)量
' ShowAllPages ---是否用下拉列表顯示所有頁(yè)面以供跳轉(zhuǎn)。有某些頁(yè)面不能使用,否則會(huì)出現(xiàn)JS錯(cuò)誤。
' strUnit ----計(jì)數(shù)單位
'返回值:“上一頁(yè) 下一頁(yè)”等信息的HTML代碼
'**************************************************
function ShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit)
dim TotalPage,strTemp,strUrl,i
if TotalNumber=0 or MaxPerPage=0 or isNull(MaxPerPage) then
ShowPage=""
exit function
end if
if totalnumber mod maxperpage=0 then
TotalPage= totalnumber \ maxperpage
Else
TotalPage= totalnumber \ maxperpage+1
end if
if CurrentPage>TotalPage then CurrentPage=TotalPage
strTemp= "<table align='center'><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首頁(yè) 上一頁(yè) "
Else
strTemp=strTemp & "<a href='" & strUrl & "page=1'>首頁(yè)</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一頁(yè)</a> "
end if
if CurrentPage>=TotalPage then
strTemp=strTemp & "下一頁(yè) 尾頁(yè)"
Else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一頁(yè)</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & TotalPage & "'>尾頁(yè)</a>"
end if
strTemp=strTemp & " 頁(yè)次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>頁(yè) "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/頁(yè)"
if ShowAllPages=True then
strTemp=strTemp & " 轉(zhuǎn)到第<input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;""'>頁(yè)"
'strTemp = strTemp &" <Input type=""button"" onClick=""window.location.href='" & strUrl & "page='+document.all.page.value;"" name=button1 value=GO >"
end if
strTemp=strTemp & "</td></tr></table>"
ShowPage=strTemp
end function
'函數(shù)名:ShowPage
'作 用:顯示“上一頁(yè) 下一頁(yè)”等信息
'參 數(shù):sFileName ----鏈接地址
' TotalNumber ----總數(shù)量
' MaxPerPage ----每頁(yè)數(shù)量
' ShowTotal ----是否顯示總數(shù)量
' ShowAllPages ---是否用下拉列表顯示所有頁(yè)面以供跳轉(zhuǎn)。有某些頁(yè)面不能使用,否則會(huì)出現(xiàn)JS錯(cuò)誤。
' strUnit ----計(jì)數(shù)單位
'返回值:“上一頁(yè) 下一頁(yè)”等信息的HTML代碼
'**************************************************
function ShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit)
dim TotalPage,strTemp,strUrl,i
if TotalNumber=0 or MaxPerPage=0 or isNull(MaxPerPage) then
ShowPage=""
exit function
end if
if totalnumber mod maxperpage=0 then
TotalPage= totalnumber \ maxperpage
Else
TotalPage= totalnumber \ maxperpage+1
end if
if CurrentPage>TotalPage then CurrentPage=TotalPage
strTemp= "<table align='center'><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首頁(yè) 上一頁(yè) "
Else
strTemp=strTemp & "<a href='" & strUrl & "page=1'>首頁(yè)</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一頁(yè)</a> "
end if
if CurrentPage>=TotalPage then
strTemp=strTemp & "下一頁(yè) 尾頁(yè)"
Else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一頁(yè)</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & TotalPage & "'>尾頁(yè)</a>"
end if
strTemp=strTemp & " 頁(yè)次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>頁(yè) "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/頁(yè)"
if ShowAllPages=True then
strTemp=strTemp & " 轉(zhuǎn)到第<input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;""'>頁(yè)"
'strTemp = strTemp &" <Input type=""button"" onClick=""window.location.href='" & strUrl & "page='+document.all.page.value;"" name=button1 value=GO >"
end if
strTemp=strTemp & "</td></tr></table>"
ShowPage=strTemp
end function
相關(guān)文章
asp下request.querystring("id")與request("id&quo
一下問(wèn)題一天遇到2次,復(fù)制過(guò)來(lái)以供下次參考,一般來(lái)說(shuō)還使用萬(wàn)能的request("id")比較好2008-01-01asp實(shí)現(xiàn)過(guò)濾關(guān)鍵字的函數(shù)
asp實(shí)現(xiàn)過(guò)濾關(guān)鍵字的函數(shù)...2007-08-08asp 下產(chǎn)生任意位數(shù)隨機(jī)密碼的代碼
asp 下產(chǎn)生任意位數(shù)隨機(jī)密碼的代碼...2007-08-08微信開(kāi)發(fā) 網(wǎng)頁(yè)授權(quán)獲取用戶基本信息
這篇文章主要介紹了微信開(kāi)發(fā) 網(wǎng)頁(yè)授權(quán)獲取用戶基本信息的相關(guān)資料,需要的朋友可以參考下2016-09-09多域名綁定到一個(gè)空間訪問(wèn)不同首頁(yè)的技巧
多域名綁定到一個(gè)空間訪問(wèn)不同首頁(yè)的技巧...2006-09-09ASP中Utf-8與Gb2312編碼轉(zhuǎn)換亂碼問(wèn)題的解決方法 頁(yè)面編碼聲明
ASP程序在同一個(gè)站點(diǎn)中,如果有UTF-8編碼的程序,又有GB2312編碼的程序時(shí),在瀏覽UTF-8編碼的頁(yè)面后,再瀏覽當(dāng)前網(wǎng)站GB2312的頁(yè)面,GB2312編碼的頁(yè)面就會(huì)出現(xiàn)亂碼2012-02-02