FSO的强大功能(6)
function isTXT(fileNameStr)
'判断是否是文本类型的文件
dim s,Arr,a,returnValue
returnValue = false
s=lcase(LastOne(fileNameStr,"."))
Arr=array("txt","htm","html","asp","csv","aspx","xml","js","vbs","ini","bat","css","htc","hta","xsl","xslt","sql")
for each a in Arr
if a=s then
returnValue =true
exit for
end if
next
isTXT = returnValue
end function
sub showFolder(obj)
dim folderspec :folderspec = obj.title
obj.setAttribute "parsed",true
if not fso.FolderExists(folderspec) then
alert folderspec & "该文件夹不存在,也许是被移动了,所以刷新一下本程序"
window.location.reload
exit sub
end if
dim f, f1, sf,sf1,i,s,fName
set f=fso.GetFolder(folderspec)
set sf=f.Subfolders
re = re & f.name & "\"
s=""
for each sf1 in sf
s = s & "<div class='folder' title='" & sf1.path & "\' style='margin-left:" & cint(replace(obj.style.marginLeft,"px","")) + 8 & ";'>"
s = s & "<span class='folderIcon'>0" & "</span><input value='" & sf1.name & "' readonly style='cursor:hand;'/></div>"
next
For Each f1 in f.Files
if isTXT(f1.name) then
s = s & "<div class='file' title='" & f1.path
s = s & "' style='margin-left:"
s = s & px2Int(obj.style.marginLeft) + 8 & ";' > "
s = s & "<span class='fileIcon'>2" & "</span>"
s = s & "<input value='"
fName = getTxtName(f1.name)
s = s & fName & "' title='" & fName & "' onchange='vbs:reName me' />"
s = s & "</div>"
end if
Next
obj.insertAdjacentHTML "AfterEnd",s
end sub
function px2Int(px)
px2Int = cint(replace(px,"px",""))
end function
sub f_Click()
dim obj,d,f,state
set obj = window.event.srcElement
if obj.id="searchKey" then exit sub
if obj.tagName<>"SPAN" and obj.tagName<>"INPUT" then exit sub
set currentDiv = obj.parentElement
内容版权声明:除非注明,否则皆为本站原创文章。