if vartype(currentSpan)=8 then
currentSpan.style.color = "navy"
end if
set currentSpan = obj
obj.style.color="red"
readText obj.parentElement.title
currentDir = ""
currentFile = obj.parentElement.title
end select
end sub
sub fold(o,stateOpen) '合拢
dim n
set n=o.nextSibling
do
if vartype(n) =9 then exit do
if px2Int(n.style.marginLeft) <= px2Int(o.style.marginLeft) then exit do
if stateOpen=1 then n.style.display="" else n.style.display="none"
set n=n.nextSibling
loop
end sub
sub readText(filePath)
Dim f,fName
if not fso.FileExists(filePath) then
alert filePath & vbcrlf & "该文件不存在,也许是被移动了,所以刷新一下本程序"
window.location.reload
exit sub
end if
'TXT已经加载的当前文件不再加载.
if filePath = currentFile then exit sub
txt.value = ""
Set f = fso.OpenTextFile(filePath, 1, true)
if not f.AtEndOfStream then
txt.value = f.readAll
else
txt.value = ""
end if
fName = lastOne(filePath,"")
articleTitle.value = getTxtName(fName)
f.Close
Ln.innerText = 1
End sub
sub TabTxt()
'支持tab键的文本框
if window.event.keyCode=38 then
if cint(Ln.innerText) >1 then Ln.innerText = cint(Ln.innerText)-1
end if
if window.event.keyCode=40 then
Ln.innerText = cint(Ln.innerText)+1
end if
if window.event.keyCode<> 9 then exit sub
dim sel,mytext
set sel = document.selection.createRange()
'txt.createTextRange
mytext = sel.text
if len(mytext)=0 then
sel.text =string(4," ")
window.event.cancelBubble = true
window.event.returnValue = false
exit sub
end if
dim t,Arr
t=0
Arr = split(mytext,vbcrlf)
if window.event.shiftKey then
'按sift
for i=0 to ubound(Arr)
if left(Arr(i),1)=vbtab then
Arr(i) = mid(Arr(i),2)
t= t + 1
else
for j=1 to 4
if left(Arr(i),1)=" " then
Arr(i) = mid(Arr(i),2)
t= t + 1
else
exit for
end if
next
end if
next
t= t
else
'不按sift
for i=0 to ubound(Arr)
Arr(i) = vbtab & Arr(i)
t= t +1
next
end if
mytext = join(Arr,vbcrlf)
sel.text = mytext
sel.collapse true
sel.moveEnd "character",0
sel.moveStart "character",(len(mytext) * -1) + t
sel.select()
window.event.cancelBubble = true
window.event.returnValue = false
end sub
'下面是关于搜索
dim seachResult'查找结果
dim num '结果数量
dim word'搜索关键字
tagStop = false
seachResult =""
sub seachFile()
num =0
seachList.innerText = "搜索结果"
word = searchKey.value
seachResult =""









