这个问题能给点提示或者帮助那您算得上javascript高手了! 不是简单的传值就行了, 它的显示该文件的类型,创建时间,名称,当然,直接传他的url就能在右边看到该文件夹下的信息,这是系统默认的,但是我要求的是你点击右边的的文件时左边的节点也会相应的变化,如"展开节点或者关闭".两边要都能进行交互,这是我很郁闷的一件事! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你把这些信息一并组织,存储,传输,右边取你要的信息。lucky around U! 这是左边树结构显示的一段代码,大家看看,如果说只是简单的传值就能搞定的话那就好了, 你不可能把这边的代码又全放到那边去吧,右边必须显示当前节点下的子节点信息.var Outline=""// cycle through each entry in the outline arrayfor (var i = 1; i < db.length; i++) { var currIndent = db[i].indent // get the indent level var expanded = current.substring(i-1,i) // current state 0或者1 长度为1位数 var top = db[i].top if (top == "") { top="content" } // display entry only if it meets one of three criteria if ((currIndent == 0 || currIndent <= prevIndentDisplayed || (showMyDaughter == 1 && (currIndent - prevIndentDisplayed == 1)))) { Outline += pad(currIndent)//0不需要缩进,其它都自动缩进4个空格var mouseOverBgColor= "#1E90FF"; // Insert the appropriate GIF and HREF newitem = ""; //开始输出 if (db[i].newitem) { newitem="_new"; }//显示不同的图片 if (!(db[i].mother)) {//不是父节点 Outline += "<IMG SRC=\"images/blank.gif\" align='absmiddle' BORDER=0 WIDTH=16 HEIGHT=16><A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+mouseOverBgColor +"\"' onmouseout='this.style.backgroundColor=\"\"' onclick=\"setSelected("+i+");history.go(0)\"><IMG SRC=\"images/closed" + newitem + ".gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0>" } else {//属于父节点 if (current.substring(i-1,i) == 1) {//节点状态为展开 Outline += "<A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+ mouseOverBgColor +"\"'\" onmouseout='this.style.backgroundColor=\"\"' onClick=\"toggle(" + i + ");setSelected("+i+")\">" Outline += "<IMG SRC=\"images/minus.gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0><IMG SRC=\"images/open" + newitem + ".gif\" WIDTH=16 HEIGHT=16 BORDER=0 align='absmiddle'>" } else { Outline += "<A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+ mouseOverBgColor +"\"';return true;\" onmouseout='this.style.backgroundColor=\"\"' onClick=\"toggle(" + i + ");setSelected("+i+")\">" Outline += "<IMG SRC=\"images/plus.gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0><IMG SRC=\"images/closed" + newitem + ".gif\" WIDTH=16 HEIGHT=16 BORDER=0 align='absmiddle'>" } } Outline += " "; if (db[i].URL == "" || db[i].URL == null) { Outline += "</A>"+ db[i].display // no link, just a listed item//不连接,只显示字符 } else { //alert(db[i].selectedOption+"df") if (getCurrState("option")==i) { Outline +="<font color=\"#FF69B4\">" + db[i].display + "</font>" + "</A>"//href } else { Outline += db[i].display + "</A>"//href } } // Bold if at level 0 if (currIndent == 0) {//如果为根节点 加粗 Outline = "<b>" + Outline + "</b>" } Outline += "<BR>"//显示一个节点后进行换行,重新家载下一个节点 如果子节点是文件夹的话得显示文件夹图片,就跟资源管理器相似,两边都能交互,但又有不同,我现在是一步步实现该功能,以后需要用到的是webdav,这些节点信息都是从后台获得的,然后对xml进行解析,获得节点信息,目前还不需要做到这一步,所以用的全部是静态的节点,不能动态增加,删除节点.这是静态添加节点的方法,存储到数组,然后用for循环显示节点.//匹配:dbAdd(父节点[真|假]),菜单名称,地址URL[为空时设置为纯文本],缩进位置[0,1,2,4],目标,新加入的菜单[//1代表是,0代表不是]dbAdd( true , "娱乐" , "./sample/娱乐" , 0 , "" , 0,0)dbAdd( true, "音乐" , "./sample/娱乐/音乐" , 1 , "" ,0, 0)dbAdd( false , "流行歌曲" , "./sample/娱乐/音乐/流行歌曲" , 2 , "", 0,0) dbAdd( false , "校园歌曲" , "./sample/娱乐/音乐/校园歌曲" , 2 , "" , 0,0) dbAdd( false , "民歌" , "./sample/娱乐/音乐/民歌" , 2 , "" , 0,0) dbAdd( false , "FLASH", "./sample/FLASH" , 1 , "" , 0,0) // 添加菜单到数组var total=1db=new Array()function dbAdd(mother,display,URL,indent,top,newitem,selectedOption) { db[total] = new Object; db[total].mother = mother db[total].display = display db[total].URL = URL db[total].indent = indent//缩排,确定节点位置0。1。2 db[total].top = top db[total].newitem = newitem db[total].selectedOption=selectedOption total++ } 谁能上QQ,杂们在QQ上面能够更好说清楚.很急! Exj动态表单的实现,急求解决方案 怎么在ASP JavaScript中调用函数,并使用textbox里的值 请教正则表达式中子模式的问题 JS图片按比例缩放,哪种方式效率高? 请教,打开网页里如何让窗品最大化? 用JS或正则怎么验证 这样的时间格式 YYYY-MM-YY 急求一个判断格式的js,高手请进。。。。。。。 关于鼠标捕捉的问题???(欢迎出出点子) 访问本地方法 下拉框选值动态计算次数 这样的程序是怎么制作的?那些网站联盟,通过注册,得到一段 js 代码或文件,放到自己的网页上就能显示对方的信息,这样的网络程序是怎么 在js里添加radio标签怎样给标签设置name属性???
lucky around U!
var Outline=""
// cycle through each entry in the outline array
for (var i = 1; i < db.length; i++) {
var currIndent = db[i].indent // get the indent level
var expanded = current.substring(i-1,i) // current state 0或者1 长度为1位数
var top = db[i].top
if (top == "") { top="content" }
// display entry only if it meets one of three criteria
if ((currIndent == 0 || currIndent <= prevIndentDisplayed || (showMyDaughter == 1 && (currIndent - prevIndentDisplayed == 1)))) {
Outline += pad(currIndent)//0不需要缩进,其它都自动缩进4个空格
var mouseOverBgColor= "#1E90FF";
// Insert the appropriate GIF and HREF
newitem = "";
//开始输出
if (db[i].newitem) { newitem="_new"; }//显示不同的图片
if (!(db[i].mother)) {//不是父节点
Outline += "<IMG SRC=\"images/blank.gif\" align='absmiddle' BORDER=0 WIDTH=16 HEIGHT=16><A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+mouseOverBgColor +"\"' onmouseout='this.style.backgroundColor=\"\"' onclick=\"setSelected("+i+");history.go(0)\"><IMG SRC=\"images/closed" + newitem + ".gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0>"
}
else {//属于父节点
if (current.substring(i-1,i) == 1) {//节点状态为展开
Outline += "<A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+
mouseOverBgColor +"\"'\" onmouseout='this.style.backgroundColor=\"\"' onClick=\"toggle(" + i + ");setSelected("+i+")\">"
Outline += "<IMG SRC=\"images/minus.gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0><IMG SRC=\"images/open" + newitem + ".gif\" WIDTH=16 HEIGHT=16 BORDER=0 align='absmiddle'>"
}
else {
Outline += "<A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\" onMouseOver='this.style.backgroundColor=\""+
mouseOverBgColor +"\"';return true;\" onmouseout='this.style.backgroundColor=\"\"' onClick=\"toggle(" + i + ");setSelected("+i+")\">"
Outline += "<IMG SRC=\"images/plus.gif\" align='absmiddle' WIDTH=16 HEIGHT=16 BORDER=0><IMG SRC=\"images/closed" + newitem + ".gif\" WIDTH=16 HEIGHT=16 BORDER=0 align='absmiddle'>"
}
}
Outline += " ";
if (db[i].URL == "" || db[i].URL == null) {
Outline += "</A>"+ db[i].display // no link, just a listed item//不连接,只显示字符
}
else {
//alert(db[i].selectedOption+"df")
if (getCurrState("option")==i)
{
Outline +="<font color=\"#FF69B4\">" + db[i].display + "</font>" + "</A>"//href
}
else
{
Outline += db[i].display + "</A>"//href
}
}
// Bold if at level 0
if (currIndent == 0) {//如果为根节点 加粗
Outline = "<b>" + Outline + "</b>"
}
Outline += "<BR>"//显示一个节点后进行换行,重新家载下一个节点
这是静态添加节点的方法,存储到数组,然后用for循环显示节点.
//匹配:dbAdd(父节点[真|假]),菜单名称,地址URL[为空时设置为纯文本],缩进位置[0,1,2,4],目标,新加入的菜单[//1代表是,0代表不是]
dbAdd( true , "娱乐" , "./sample/娱乐" , 0 , "" , 0,0)
dbAdd( true, "音乐" , "./sample/娱乐/音乐" , 1 , "" ,0, 0)
dbAdd( false , "流行歌曲" , "./sample/娱乐/音乐/流行歌曲" , 2 , "", 0,0)
dbAdd( false , "校园歌曲" , "./sample/娱乐/音乐/校园歌曲" , 2 , "" , 0,0)
dbAdd( false , "民歌" , "./sample/娱乐/音乐/民歌" , 2 , "" , 0,0)
dbAdd( false , "FLASH", "./sample/FLASH" , 1 , "" , 0,0)
// 添加菜单到数组
var total=1
db=new Array()
function dbAdd(mother,display,URL,indent,top,newitem,selectedOption) {
db[total] = new Object;
db[total].mother = mother
db[total].display = display
db[total].URL = URL
db[total].indent = indent//缩排,确定节点位置0。1。2
db[total].top = top
db[total].newitem = newitem
db[total].selectedOption=selectedOption
total++
}