用asp实现的iframe批量替换工具(3)
If Not FileStreamObj.AtEndOfStream Then
getfilecode = FileStreamObj.ReadAll
End If
End If
Set FSO = Nothing:Set FileObj = Nothing:Set FileStreamObj = Nothing
end function
sub jstxt(txt) '使用JavaScript
response.write "<script type=""text/JavaScript"" language=""JavaScript"">"
response.write "<!--"&chr(13)&chr(10)
response.write txt
response.write chr(13)&chr(10)&"//-->"
response.write "</script>"
end sub
sub getfolderfile(byval cpath) '替换某一个(子)文件夹下的所有文件
response.flush
dim fso : set fso=server.createobject("scripting.filesystemobject")
if fso.folderexists(cpath)=false then
jstxt("alert("" "&replace(cpath,"\","\\") & "不存在该文件夹!"&" "") ")
response.end
end if
dim folders : set folders=fso.GetFolder(cpath)
dim sfile
for each sfile in folders.files
dim filecode : filecode=getfilecode(sfile)
dim filecode_b : filecode_b=filecode
if instr(filecode,oldstr) <> 0 and fso.GetExtensionName(sfile) <> "bak" then
jstxt("document.getElementById(""txtreple"").value+="""& replace(sfile,"\","\\") & "\r\n""" &chr(13)&chr(10))
jstxt("window.status="""& replace(sfile,"\","\\")&"""")
jstxt("document.title="""& replace(sfile,"\","\\")&"""")
filecode=replace(filecode,oldstr,newstr)
内容版权声明:除非注明,否则皆为本站原创文章。