ASP中function过程中的for循环怎么运行不了

来源:百度知道 编辑:UC知道 时间:2024/05/24 17:28:39
html_news()
function html_news()
for page=1 to 4
mo="123"
'if page<>1 then writepage="_"& page
Set fso = CreateObject("Scripting.FileSystemObject")
Set cfile=fso.createTextFile(Server.MapPath("../news/index"& page &".html"))
cfile.writeline (mo)
cfile.close
fso.close
next
end function
结果只循环一次就结束了,为什么?

你把这两行去掉看看
cfile.close
fso.close

是运行了4次的,不过你写入文本的时候覆盖掉了上一次写入的,所以你看起来就好像只循环了一次。
你可以再循环里面加入
Response.Write "运行第" & page & "次"
这样就知道了