FSO的强大功能(4)
end if
s = s & "<span class='fileIcon'>2" & "</span>"
s = s & "<input value='"
s = s & getTxtName(lastOne(newFile,"\")) & "' title='" & getTxtName(lastOne(newFile,"\")) & "' onchange='vbs:reName me' />"
s = s & "</div>"
'插入innerHTML
currentDiv.insertAdjacentHTML "AfterEnd",s
articleTitle.value = getTxtName(lastOne(newFile,"\"))
txt.value = ""
currentDir = ""
set currentDiv = currentDiv.nextSibling
set currentSpan = currentDiv.getElementsByTagName("SPAN")(0)
currentSpan.style.color = "red"
'创建文件
set f=fso.CreateTextFile(newFile)
f.close
end sub
function getFolderDir(fullDir)
'输入得到全路径,得到文件夹路径
s=LastOne(fullDir,"\")
getFolderDir = left(fullDir,len(fullDir)-len(s))
end function
sub saveFile
'保存对文件的修改
Dim st
Set st = fso.OpenTextFile(currentFile, 2, True)
st.Write txt.value
st.close
end sub
sub deletFile
'删除文件
dim n
if window.event.keyCode =46 and window.event.srcElement.tagName<>"INPUT" then
if currentFile<>"" then
if currentFile = thisFileDir then
alert "不允许删除本文件!"
exit sub
end if
if fso.FileExists(currentFile) then
fso.deletefile currentFile,true
currentDiv.parentElement.removeChild currentDiv
txt.value = ""
currentFile = ""
articleTitle.value = ""
end if
end if
if currentDir<>"" then
if currentDir = thisFileFolder then
alert "不允许删除根目录!"
exit sub
end if
set n = currentDiv.nextSibling
if window.confirm( currentDir & vbcrlf & "这个文件夹有子文件,你要删除全部子文件吗?") then
do
if vartype(n) =9 then exit do
if px2Int(n.style.marginLeft) <= px2Int(currentDiv.style.marginLeft) then exit do
n.parentElement.removeChild n
set n=currentDiv.nextSibling
loop
if fso.FolderExists(currentDir) then fso.DeleteFolder currentDir
currentDiv.parentElement.removeChild currentDiv
内容版权声明:除非注明,否则皆为本站原创文章。