<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
</head>
<body>
<a href="javascript: d.openAll();"><font color="blue" style="font-size: 11px">全部打开</font></a> | <a href="javascript: d.closeAll();"><font color="blue" style="font-size: 11px">全部收起</font></a></p>
<script type="text/javascript">
d = new dTree('d');
d.add(0,-1,'第一级','javascript:go(0,0);');
d.add(1,0,'第二级1','javascript:go(1,0);');
d.add(2,0,'第二级2','javascript:go(1,0);');
d.add(3,1,'第三级1','javascript:go(3,1);');
d.add(4,2,'第三级2','javascript:go(4,2);');
d.add(5,3,'第四级1','javascript:go(5,3);');
document.write(d);
</script>
<script type="text/javascript">
function go(id,perid){
d.closeAll();
d.openTo(id, true);
//你要写的js内容
alert("你点击的是id为"+id+",父节点id为"+perid+"的节点,你可以在此处控制连接");
}
</script>
</body>
</html>