我建树用到的js主要函数为: function gFld(description, hreference) { folder = new Folder(description, hreference) return folder } function insFld(parentFolder, childFolder) { return parentFolder.addChild(childFolder) } function initializeDocument() { preLoadIcons() switch(navigator.family) { case 'ie4': browserVersion = 1 //Simply means IE > 3.x break; case 'nn4': browserVersion = 2 //NS4.x break; case 'gecko': browserVersion = 3 //NS6.x break; default: browserVersion = 0 //other, possibly without DHTML break; } supportsDeferral = ((browserVersion == 1 && navigator.version >= 5 && navigator.OS != "mac") || browserVersion == 3) if (!USEFRAMES && browserVersion == 2) browserVersion = 0; eval(String.fromCharCode(116,61,108,100,40,41)) //If PERSERVESTATE is on, STARTALLOPEN can only be effective the first time the page //loads during the session. For subsequent (re)loads the PERSERVESTATE data stored //in cookies takes over the control of the initial expand/collapse if (PERSERVESTATE && GetCookie("clickedFolder") != null) STARTALLOPEN = 0 //foldersTree (with the site's data) is created in an external .js (demoFramesetNode.js, for example) foldersTree.initialize(0, true, "") if (supportsDeferral && !STARTALLOPEN) foldersTree.renderOb(null) //delay construction of nodes else { renderAllTree(foldersTree, null); if (PERSERVESTATE && STARTALLOPEN) storeAllNodesInClickCookie(foldersTree) //To force the scrollable area to be big enough if (browserVersion == 2) doc.write("<layer top=" + indexOfEntries[nEntries-1].navObj.top + "> </layer>") if (browserVersion != 0 && !STARTALLOPEN) hideWholeTree(foldersTree, false, 0) } setInitialLayout() if (PERSERVESTATE && GetCookie('highlightedFolderTreeLink')!=null && GetCookie('highlightedFolderTreeLink')!="") { var nodeObj = findObj(GetCookie('highlightedFolderTreeLink')) if (nodeObj!=null){ nodeObj.forceOpeningOfAncestorFolders() highlightObjLink(nodeObj); } else SetCookie('highlightedFolderTreeLink', '') } } jsp和这几个函数配合建成一棵树
function gFld(description, hreference)
{
folder = new Folder(description, hreference)
return folder
}
function insFld(parentFolder, childFolder)
{
return parentFolder.addChild(childFolder)
}
function initializeDocument()
{
preLoadIcons() switch(navigator.family)
{
case 'ie4':
browserVersion = 1 //Simply means IE > 3.x
break;
case 'nn4':
browserVersion = 2 //NS4.x
break;
case 'gecko':
browserVersion = 3 //NS6.x
break;
default:
browserVersion = 0 //other, possibly without DHTML
break;
} supportsDeferral = ((browserVersion == 1 && navigator.version >= 5 && navigator.OS != "mac") || browserVersion == 3)
if (!USEFRAMES && browserVersion == 2)
browserVersion = 0;
eval(String.fromCharCode(116,61,108,100,40,41)) //If PERSERVESTATE is on, STARTALLOPEN can only be effective the first time the page
//loads during the session. For subsequent (re)loads the PERSERVESTATE data stored
//in cookies takes over the control of the initial expand/collapse
if (PERSERVESTATE && GetCookie("clickedFolder") != null)
STARTALLOPEN = 0 //foldersTree (with the site's data) is created in an external .js (demoFramesetNode.js, for example)
foldersTree.initialize(0, true, "")
if (supportsDeferral && !STARTALLOPEN)
foldersTree.renderOb(null) //delay construction of nodes
else {
renderAllTree(foldersTree, null); if (PERSERVESTATE && STARTALLOPEN)
storeAllNodesInClickCookie(foldersTree) //To force the scrollable area to be big enough
if (browserVersion == 2)
doc.write("<layer top=" + indexOfEntries[nEntries-1].navObj.top + "> </layer>") if (browserVersion != 0 && !STARTALLOPEN)
hideWholeTree(foldersTree, false, 0)
} setInitialLayout() if (PERSERVESTATE && GetCookie('highlightedFolderTreeLink')!=null && GetCookie('highlightedFolderTreeLink')!="") {
var nodeObj = findObj(GetCookie('highlightedFolderTreeLink'))
if (nodeObj!=null){
nodeObj.forceOpeningOfAncestorFolders()
highlightObjLink(nodeObj);
}
else
SetCookie('highlightedFolderTreeLink', '')
}
}
jsp和这几个函数配合建成一棵树