急求救:Microsoft VBScript 运行时错误 错误 '800a000d' 类型不匹配: '[string: ""]'

来源:百度知道 编辑:UC知道 时间:2024/05/23 19:28:43
正在使用的计数器突然出现错误,显示如下:

Microsoft VBScript 运行时错误 错误 '800a000d'
类型不匹配: '[string: ""]'
/count.asp,行 35

具体的源文件如下:

<%
'Option Explicit

Dim fs, Filename, txt, Content, counterLenth, displayMode
counterLenth=7 '设置显示数据的最小长度,如果小于实际长度则以实际长度为准
displayMode = 2 '设置显示模式,1为文字,2为图片

Filename=Server.MapPath("count.txt")
Set fs=Server.CreateObject("Scripting.FileSystemObject")

'初始化
function init()

'用Application缓存数据
if Application("Counter")="" then
'检查文件是否存在,不存在则创建,并写入0
If Not fs.FileExists(Filename) Then
fs.CreateTextFile Filename,True,True
Set txt=fs.OpenTextFile(Filename,2,True)
txt.Write 0
txt.close()
set txt=nothing
End If
'缓存为空,则读取文本数据
Set txt=fs.OpenTextFile(Filename,1,1)
If txt.AtEndOfStream Then
Applic

If txt.AtEndOfStream Then
Application("Counter")=0 '如果文件中没有数据,则初始化Application("Counter")的值(为了容错)
else
Application("Counter")=txt.readline
'这里也添加一个容错处理
if not isnumeric(Application("Counter") & "") then
Application("Counter")=0
end if
end if

如果显示不了原来的计数
打开count.txt 在里面输入一个 数字就可以了
——————————————————————————————————————
修改count.txt 要先停用一下网站 重新启动网站后才能生效 否则输入的数字就被覆盖了!!