小弟初学.net,请教个菜问题,谢谢
一个js写的树形菜单,单独存为一个文件treemenu.js,一个页面文件menu.aspx上只显示这个树形菜单,在menu.aspx文件的<head>里加了
<script language="javascript" src="treemenu.js" type="text/javascript"></script>
然后如何调用treemenu.js里的的函数构成,显示这个树形菜单???(或者说是应该在哪调用那些函数,是和asp那样在<table>里加<script>吗??)
需要看你那個js文件是如何給出接口的 在如何掉用
哦,这些是用的到的代码
function Folder(folderDescription, hreference) //constructor
{
//constant data
descTemp_arr = folderDescription .split("|");
this.desc=descTemp_arr[0] ;//strRemoveHtml(descTemp_arr[0]);
// 获取节点类型,Modify by YCJ
if( descTemp_arr[1] == null ) {
this.folderType = "ftv2Gen"; //default type is iGen
} else {
this.folderType = descTemp_arr[1];
}
//Assign folder default icon,Modify by YCJ
if( descTemp_arr[2] == null ) {
this.iconSrc = "../images/" + this.folderType + "Folder.gif" ;
} else {
this.iconSrc = descTemp_arr[2];
}
//Assign folder open icon,modify by YCJ
if( descTemp_arr[3] == null ) {
Temp_arr1 = this.iconSrc .split(".");
this.iconSrcOpen = Temp_arr1[0] + "Open.gif" ;
} else {
this.iconSrcOpen = descTemp_arr[3];
}
//this.desc = folderDescription
this.hreference = hreference
this.id = -1
this.navObj = 0
this.iconImg = 0
this.nodeImg = 0
this.isLastNode = 0
//dynamic data
this.isOpen = true
this.children = new Array
this.nChildren = 0
//methods
this.initialize = initializeFolder
this.setState = setStateFolder
this.addChild = addChild
this.createIndex = createEntryIndex
this.hide = hideFolder
this.display = display
this.renderOb = drawFolder
this.totalHeight = totalHeight
this.subEntries = folderSubEntries
this.outputLink = outputFolderLink
}
function insFld(parentFolder, childFolder)
{
return parentFolder.addChild(childFolder)
}
function gFld(description, hreference)
{
folder = new Folder(description, hreference)
return folder
}
function initializeDocument()
{
if (doc.all)
browserVersion = 1 //IE4
else
if (doc.layers)
browserVersion = 2 //NS4
else
browserVersion = 0 //other
foldersTree.initialize(0, 1, "")
foldersTree.display()
if (browserVersion > 0)
{
doc.write("<layer top="+indexOfEntries[nEntries-1].navObj.top+"> </layer>")
// close the whole tree
clickOnNode(0)
// open the root folder
clickOnNode(0)
}
}