最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
一个实现任意改变计数器位数的函数。
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
'$U2 Forum rautinee原创$
'$http://u2bbs.126.com$
'下面的函数将实现任意改变计数器位数,你要做的准备工作是:
'1、999_count.txt建立一个文本文件,并把初始值设为0。
'2、准备一组数字图片放在gif目录下
Function GCounter(CounterLen)'CounterLen是计数器的位数
CountFile=Server.MapPath("999_count.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)
counter=Out.ReadLine'读取'999_count.txt里面的计数值
Out.Close
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.CreateTextFile(CountFile,TRUE,FALSE)
Application.lock
counter=counter+1'累计加1
Out.WriteLine(counter)
Application.unlock
Out.Close
Dim S, i, G ,n
S = CStr( counter )
if Len(s) 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
'$http://u2bbs.126.com$
'下面的函数将实现任意改变计数器位数,你要做的准备工作是:
'1、999_count.txt建立一个文本文件,并把初始值设为0。
'2、准备一组数字图片放在gif目录下
Function GCounter(CounterLen)'CounterLen是计数器的位数
CountFile=Server.MapPath("999_count.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)
counter=Out.ReadLine'读取'999_count.txt里面的计数值
Out.Close
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.CreateTextFile(CountFile,TRUE,FALSE)
Application.lock
counter=counter+1'累计加1
Out.WriteLine(counter)
Application.unlock
Out.Close
Dim S, i, G ,n
S = CStr( counter )
if Len(s)
G = G&""
Next
End if
For i = 1 to Len(S)
G = G & ""
Next
response.write G
End Function
相关文章
- wps使用函数的方法 07-04
- Python递归函数定义与用法 06-05
- 如何学会创建并调用函数 05-18
- golang 函数中函数和方法有什么区别 05-13
- python socket函数中,send与sendall有什么区别 怎么使用 05-11
- wps表格中怎么使用函数 使用方法 04-17