ShowPage Packaging code for information such as "previous page next page"-Application Tips

Source: Internet
Author: User
'**************************************************
' Function name: showpage
' Function: Show "previous page next page" and other information
' parameter: sfilename----link Address
' Total number of totalnumber----
' Maxperpage----number per page
' Showtotal----Show total quantity
' Showallpages---whether to use the Drop-down list to display all the pages for jump. Some pages are not available, otherwise a JS error will appear.
' Strunit----count unit
' Return value: The HTML code for information such as previous page next page
'**************************************************
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 & "Total <b>" & Totalnumber & "</b>" & Strunit & ""
End If
Strurl=joinchar (sFileName)
If Currentpage<2 Then
Strtemp=strtemp & "Home Page Up"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=1 ' > Home </a>"
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & (CurrentPage-1) & "' > Previous </a>"
End If

If Currentpage>=totalpage Then
Strtemp=strtemp & "Next Page last"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & (currentpage+1) & "' > Next page </a>"
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & Totalpage & "' > Last </a>"
End If
Strtemp=strtemp & "page: <strong><font color=red>" & currentpage & "</font>/" & Totalpage & "</strong> page"
Strtemp=strtemp & "<b>" & Maxperpage & "</b>" & strunit & "/page"
If Showallpages=true Then
Strtemp=strtemp & "goto <input type= ' text ' name= ' page ' size= ' 3 ' maxlength= ' 5 ' value= '" & CurrentPage & "' O Nkeypress= "" if (event.keycode==13) window.location= ' "& strURL &" page= "&" ' +this.value; "" > page "
' strtemp = strtemp & <input type= ' button ' ' onclick= ' ' window.location.href= ' ' & strURL & ' page= ' +documen  T.all.page.value; "" Name=button1 Value=go > "
End If
Strtemp=strtemp & "</td></tr></table>"
Showpage=strtemp
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.