xtree可以
不知道你是否需要动态加载功能。。

解决方案 »

  1.   

    用javascript做一个函数就可以完成这样的效果了
    不过csdn怎么做的就不知道了
      

  2.   

    下面是我的一个程序改的,把主菜单的onclick事件加到树形菜单的小加号就可以了,如果使用php的循环语句还可以实现动态加载菜单<?
    session_register("user","client");
    $_SESSION['user']='';
    $_SESSION['client']='yes';
    ?><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    <link href="style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .style1 {color: #FFFFFF}
    body {
    margin-top: 0px;
    }
    .style2 {
    font-size: 14px;
    font-family: "黑体";
    }
    -->
    </style>
    </head>
    <script type="text/javascript">
    function menu(sid)  //显示和隐藏菜单树
    {
        var name;
    name=eval("menu"+sid);
    if(name.style.display=="none")
        eval("menu"+sid+".style.display=\"\";");
    else
        eval("menu"+sid+".style.display=\"none\";");
    }
    function submenu(sid) //显示和隐藏分级菜单
    {
        var menuname;
    menuname=eval("submenu"+sid);
    if(menuname.style.display=='none')
    {
        eval("submenu"+sid+".style.display=\"\";");
    }
    else
    {
        eval("submenu"+sid+".style.display=\"none\";");
    }
    }
    </script>
    <body>
    <table width="100%" height="115"  border="0" align="center" cellpadding="0" cellspacing="0" id="menu2">
      <tr>
        <td height="120" valign="top" background="images/bg_1.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="4">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2">&nbsp;</td>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="4">&nbsp;</td>
            </tr>
            <tr>
              <td width="4%">&nbsp;</td>
              <td width="6%">&nbsp;</td>
              <td width="22%">&nbsp;</td>
              <td width="68%">&nbsp;</td>
            </tr>
        </table></td>
      </tr>
    </table>
    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#1B5FA8" onClick="menu(2)" style="cursor:crosshair; ">
      <tr>
        <td width="3%">&nbsp;</td>
        <td width="19%"><span class="style1">今天为:</span><font color="#FFFFFF"><font color="#FFffff">
        </font></font><font color="#FFFFFF">
        <?=date('Y年m月j日')?>
        </font></td>
        <td width="5%" align="center"><span class="style1">|</span></td>
        <td width="47%"><font color="#FFFFFF">      <span class="style1">欢迎您:</span><font color="#FFffff">      </font><font color="#FFffff">
          <?=$_SESSION['user']?>
        </font><span class="style1"></span> </font></td>
        <td width="2%"><span class="style1"><a href="../chinese/index.php"><img src="images/b_home.png" width="16" height="16" border="0"></a></span></td>
        <td width="11%"><a href="../chinese/index.php"><span class="style1">返回首页</span></a></td>
        <td width="3%" align="right"><a href="exit.php"><img src="images/b_exit.gif" width="16" height="16" border="0"></a></td>
        <td width="7%" align="right"><a href="exit.php"><span class="style1">退出登陆</span></a></td>
        <td width="3%">&nbsp;</td>
      </tr>
    </table>
    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="200" valign="top" bgcolor="#BFD2EC" id="menu1" style="display: ; "><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="25" align="center" style="cursor:pointer; " onClick="submenu(1)"><span class="style2">个人信息管理</span></td>
          </tr>
          <tr>
            <td align="center" id="submenu1" style="display:; "><table width="70%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="25" align="center"><a href="modify_info.php" target="mainpage">修改个人资料</a></td>
              </tr>
              <tr>
                <td height="25" align="center"><a href="modify_pwd.php" target="mainpage">修改帐号信息</a></td>
              </tr>
            </table></td>
          </tr>
      <tr>
        <td height="25" align="center" style="cursor:pointer; " onClick="submenu(2)"><span class="style2">新闻信息管理</span></td>
      </tr>
      <tr>
        <td align="center" id="submenu2" style="display:; "><table width="70%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="25" align="center"><a href="info_list.php" target="mainpage">已发布信息</a></td>
              </tr>
              <tr>
                <td height="25" align="center"><a href="info_add.php" target="mainpage">发布新信息</a></td>
              </tr>
            </table></td>
        </tr>
      <tr>
        <td align="center">&nbsp;</td>
        </tr>
        </table></td>
        <td width="15" height="500" bgcolor="#1B5FA8" style="cursor:crosshair; " onClick="menu(1)">&nbsp;</td>
        <td align="center" valign="top" bgcolor="#BFD2EC"><iframe frameborder="0" height="100%" id="mainpage" marginheight="0" marginwidth="0" name="mainpage" scrolling="auto" width="100%" src="main.php" align="middle"></iframe></td>
      </tr>
    </table><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" bgcolor="#1B5FA8"><span class="style1"></span></td>
      </tr>
    </table>
    </body>
    </html>
      

  3.   

    我准备用jsp + javascript来做,
    要实现查询数据库,实在动态的变化。
      

  4.   

    那就用JSP写循环就可以了
    javascript控制的是某个单元格的显示和隐藏,你在被控制的单元格里插入一个表格,然后在那个表格里写循环语句就可以把动态子菜单提取出来,同样的道理主菜单也可以这样来生成,这样整个菜单就是动态的了
      

  5.   

    阿信的树http://fason.nease.net/samples/xtree/
      

  6.   

    你如果需要的话 我可以发一份源码给你,留下你的mail
    或者最好给我留言,也许我不会在看到这个帖子,或者给我email都可以
    [email protected]