请教一段代码

yinhualanman 2005-10-16 12:24:22
<script language="vbscript" runat="server">
function getvotefile()
dim fullpath,position
fullpath=request.servervariables("PATH_TRANSLATED")
position=InstrRev(fullpath,"\")
getvotefile=mid(fullpath,1,position) & "vote1.txt"
end function
</script>

<html>
<head><title>文本方式的投票结果</title></head>
<body>
<%
dim rec_cnt,ttl_cnt,sum_cnt
dim each_per(4)
dim vote_name(4)
dim vote_cnt(4)
on error resume next
votefile=getvotefile()
rec_cnt=CInt(request.form("radiobutton"))
set objfs=createobject("scripting.filesystemobject")
set objreadts=objfs.opentextfile(votefile,1,0,0)
i=0
while not objreadts.AtEndOfStream
trecord=objreadts.readline
vote_name(i)=left(rtrim(trecord),3)
vote_cnt(i)=right(rtrim(trecord),6)
if i=rec_cnt then
j=clng(vote_cnt(i))+1
vote_cnt(i)=right(space(6) & trim(cstr(j)),6)
end if
wend
objreadts.close
set objwritets=objfs.createtextfile(votefile,-1,0)
ttl_cnt=0
for j=0 to (i-1)
ttl_cnt=ttl_cnt+clng(vote_cnt(j))
objwritets.WriteLine vote_name(j) & vote_cnt(j)
next
objwritets.close
。。。。。。
请问为什么执行这段代码后会将vote1.txt里的内容清空啊?
...全文
43 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jspadmin 2005-10-16
  • 打赏
  • 举报
回复
晕啊,检查vote1.txt里的格式

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧