日期:2014-05-16 浏览次数:20393 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
?<title>菜单树</title>
?<link rel="StyleSheet" href="dtree.css" type="text/css" />
?<script type="text/javascript" src="dtree.js"></script>
?<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<script type="text/javascript">
function nodeselect(id,pid,name){
alert("节点ID:"+id+"|节点名称:"+name+"|父节点ID:"+pid);
}
</script>
<div class="dtree">
?<p><a href="javascript: d.openAll();">全部展开</a>
?| <a href="javascript: d.closeAll();">全部折叠</a>
?| <a href="javascript: d.openTo(1,true,false);">展开到某个节点</a></p>
?
?<script type="text/javascript">
?? //add = function(id, pid, name, url, title, target, icon, iconOpen, open)
??d = new dTree('d');
??//d.add(0,-1,"<image src='img/flow.gif'/><font color=blue>菜单树</font>");
??d.add(0,-1,'菜单树');
??d.add(1,0,'国务院办公厅',"javascript:nodeselect('1','0','国务院办公厅')",'国务院办公厅');
??d.add(2,1,'国家一把手',"javascript:nodeselect('2','1','国家一把手')");
??d.add(3,1,'国家二把手',"javascript:nodeselect('3','1','国家二把手')");
??d.add(4,2,'胡先生',"javascript:nodeselect('4','2','胡先生')");
??d.add(5,3,'温先生',"javascript:nodeselect('5','2','温先生')");
??
??d.add(6,0,'国家财政局',"javascript:nodeselect('6','0','国家财政局')",'国家财政局','','','img/imgfolder.gif');
??d.add(7,6,'财政局局长',"javascript:nodeselect('7','6','财政局局长')");
??d.add(8,7,'老裴',"javascript:nodeselect('8','7','老裴')");
??document.write(d);
?</script>
</div>
<div class="dtree">
?<p><a href="javascript: dtree.openAll();">全部展开</a>
?| <a href="javascript: dtree.closeAll();">全部折叠</a>
?| <a href="javascript: dtree.openTo(6,true,false);">展开到某个节点</a></p>
?
? <script type="text/javascript">
?? //add = function(id, pid, name, url, title, target, icon, iconOpen, open)
??dtree = new dTree('dtree');
??//d.add(0,-1,"<image src='img/flow.gif'/><font color=blue>菜单树</font>");
??dtree.config.useIcons=false;
??dtree.add(0,-1,'菜单树');
??dtree.add(1,0,'国务院办公厅',"javascript:nodeselect('1','0','国务院办公厅')",'国务院办公厅');
??dtree.add(2,1,'国家一把手',"javascript:nodeselect('2','1','国家一把手')");
??dtree.add(3,1,'国家二把手',"javascript:nodeselect('3','1','国家二把手')");
??dtree.add(4,2,'胡先生',"javascript:nodeselect('4','2','胡先生')");
??dtree.add(5,3,'温先生',"javascript:nodeselect('5','2','温先生')");
??
??dtree.add(6,0,'国家财政局',"javascript:nodeselect('6','0','国家财政局')",'国家财政局','','','img/imgfolder.gif');
??dtree.add(7,6,'财政局局长',"javascript:nodeselect('7','6','财政局局长')");
??dtree.add(8,7,'老裴',"javascript:nodeselect('8','7','老裴')");
??document.write(dtree);
?</script>
</div>
</body>
</html>