A pagination display function of asp simulated by vbs

Source: Internet
Author: User

I just finished a project and was bored. I wanted to change my HomePage, but I didn't have the Asp permission. So I was surprised to use vbs to simulate an image paging display function! Because the write function is suitable for your use, it is inevitable that many places are not perfect! Please give me some comments when you pass by. If you want to find similar functions, you may be able to help. In addition, I wish every friend of the Forum a Happy New Year! Copy codeThe Code is as follows: <script language = VBS>
Function showINDEXPAGE ()
JS = 1
WebPath = window. location
Do until Left (webPATH, 1) = "#" or JS = len (window. location)
JS = JS + 1
WebPATH = Right (window. location, JS)

Loop
If JS = len (window. location) then showINDEXPAGE = 1 else showINDEXPAGE = Replace (webPATH ,"#","")
END Function

QZ = "" 'prefix of the image file to be displayed
HZ = ". gif" 'Suffix of the image file to be displayed
TheMAX = 98 'maximum number of displayed images
TheSKIP = 5' number of images displayed per line
ThePAGE = 20' how many images are displayed per page

TheINDEX = int (theMAX/thePAGE)
If theMAX mod thePAGE <> 0 then theINDEX = theINDEX + 1

For I = 1 to theINDEX
ShowINDEX = "<a href = #" & I & "onclick = window. location. reload ()> "&" ["& I &"] "&" </a>"
Document. write showINDEX
Next
Document. write "<br>

If thePAGE = 0 then thePAGE = theMAX
For I = 1 to thePAGE
TheNUM = I + thePAGE * (showINDEXPAGE ()-1)
If theNum> theMAX then EXIT
If theNUM <10 then
Temp = " </img>"
Else if theNum <100 then
Temp = " </img>"
Else
Temp = " </img>"
End if
End if
Document. write temp
If theSKIP <> 0 then if I mod theSKIP = 0 then document. write "<br>"
Next

Document. write "For I = 1 to theINDEX
ShowINDEX = "<a href = #" & I & "onclick = window. location. reload ()> "&" ["& I &"] "&" </a>"
Document. write showINDEX
Next
</Script>

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.