vbscript版的TreeView,也就是树[5]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 efei 的 blog

"
???
???set objtab = document.getelementbyid(me.key)
???objtab.border = "0"
???objtab.cellpadding = "0"
???objtab.cellspacing = "0"
???
???set objtr = objtab.insertrow()
???
???for i = 1 to me.level
????set objtd = objtr.insertcell()
????objtd.innerhtml = ""
???next
???
???set objtd = objtr.insertcell()
???
???dim strimg
???if me.parentobject.useconnectline then
????strimg = "lplus.gif"
???else
????strimg = "rplus.gif"
???end if
???objtd.innerhtml = ""
???
???objtd.height = 15
???set objtd = objtr.insertcell()
???if me.image = "" then
????objtd.innerhtml = ""
???else
????objtd.innerhtml = ""
???end if
???set objtd = objtr.insertcell()
???objtd.nowrap = "1"????'不换行
???'objtd.height = "25"
???if me.hyperlink = "" then
????objtd.innerhtml = ""
???else
????objtd.innerhtml = "" & me.text & ""
???end if
???
??end if
??
??
?end function
?
?'===孩子节点的集合=============================================================
?public function children(byval index)
??dim i
??set children = nothing
??index = trim(index)
??if isnumeric(index) = false then
???for i=0 to ubound(childrennodes)
????if ucase(childrennodes(i).key) = ucase(index) then
?????set children = childrennodes(i)
?????exit function
????end if
???next
??else
???if cint(index) < 1 or cint(index) > childrencount then
????exit function
???else
????set children = childrennodes(cint(index) - 1)
???end if
??end if
?end function
?'==============================================================================
?
?'===添加一个子节点
?public function addchild(objnode)
??redim preserve childrennodes(childrencount)
??set childrennodes(childrencount) = objnode
??childrencount = childrencount + 1
?end function
?
?'===展开状态
?public property get expandstatus()
??expandstatus = lexpandstatus
?end property
?public property let expandstatus(byval vnewvalue)
??dim plusvalue
??if me.parentnode is nothing or not me.parentobject.useconnectline then
???if me.childrencount > 0 then
????plusvalue = "r"
???else
????plusvalue = "blank"
???end if
??else
???if me.nextnode is nothing then
????plusvalue = "l"
???else
????plusvalue = "t"
???end if
??end if
??
??if vnewvalue = 0 then
???if me.childrencount > 0 or lfirstdisplay = true then
????plusvalue = plusvalue & "plus"
???end if
??elseif vnewvalue = 1 then
???if me.childrencount > 0 then
????plusvalue = plusvalue & "minus"
???end if
???lfirstdisplay = false
??end if
??
??lexpandstatus = vnewvalue
??document.getelementbyid("plus" & me.key).src = me.parentobject.imagepath & plusvalue & ".gif"?
?end property
?
?
?'===显示状态
?public property get displaystatus()
??displaystatus = ldisplaystatus
?end property
?public property let displaystatus(byval vnewvalue)
??if not me.parentnode is nothing then
???if cbool(vnewvalue) and not cbool(me.parentnode.expandstatus) then
????exit property
???end if
??end if
??
??
??ldisplaystatus = vnewvalue
??
??dim obj
??set obj = document.getelementbyid(me.key)
??if not obj is nothing then
???set obj = obj.parentelement.parentelement
???if cbool(vnewvalue) then
????obj.style.display = ""
???else
????obj.style.display = "none"
???end if
??end if
??set obj = nothing
?end property
?
?'===节点图标
?public property get image()??'带目录的文件名
??image = limage
?end property
?public property let image(byval vnewvalue)
??limage = vnewvalue

本文关键:vbscript版的TreeView,也就是树
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top