ASP 中的function 怎样跳出循环并返回一个值?
<%
on error resume next
'path 文件夹路径,clientid 文件夹名 filename 文件名
function bianli1(path,clientid,filename)
set fso=server.CreateObject("scripting.filesystemobject")
set objFolder=fso.GetFolder(path)
set objSubFolders=objFolder.Subfolders
for each objSubFolder in objSubFolders
if objSubFolder.name=clientid then
nowpath=path + "\" + objSubFolder.name
set objFiles=objSubFolder.Files
for each objFile in objFiles
Response.Write "<br>---"
pathname=path+objSubFolder.name+"/"+objFile.name
Response.Write pathname
if pathname=filename then
return bianli1=1
end if
next
end if
next
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
binali1=0
end function
aa=bianli1("G:/yt12/asp/orderfile/","012","G:/yt12/asp/orderfile/012/ysf_r9_c2.gif")
Response.Write "aa="&aa
%>
我想如果存在此文件就反回1,否则返回0.
这样写不能达到我想要的目底,请问这个函数错在哪里?主要是不能很到返回的值