A function that implements any change in the number of counter digits.

Source: Internet
Author: User
function | counter ' $U 2 Forum rautinee original $
' $http://u2bbs.126.com$
' The following function will implement any change in counter digits, and the preparation you want to do is:
' 1, 999_count.txt creates a text file and sets the initial value to 0.
' 2, prepare a set of digital pictures placed in the GIF directory
Function gcounter (Counterlen) ' Counterlen is the number of digits of the counter
Countfile=server.mappath ("999_count.txt")
Set fileobject=server.createobject ("Scripting.FileSystemObject")
Set Out=fileobject.opentextfile (Countfile,1,false,false)
Counter=out.readline ' read ' 999_count.txt inside the count value
Out.close

Set fileobject=server.createobject ("Scripting.FileSystemObject")
Set Out=fileobject.createtextfile (Countfile,true,false)
Application.Lock
Counter=counter+1 ' cumulative plus 1
Out.writeline (counter)
Application.UnLock
Out.close
Dim S, I, G, n
S = CStr (counter)
If Len (s) <counterlen then
For n = 1 to Counterlen-len (s)
G = g& "Next
End If
For i = 1 to Len (S)
g = g & "Next
Response.Write G
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.