侧栏式折叠菜单NavBar 怎么和数据库绑定?像这样 就是把它上面的值替换成 数据库的   在那修改?

解决方案 »

  1.   

    像csdn旁边的树形导航栏???。net里面大概可以用treeview控件做。不过先要将需要显示的数据写成xml文件,让treeview读取xml的名字是固定的,忘记了,lz自己找一下
      

  2.   

    如果单单是js和数据库连接还是不可以的,可以用别的语言得到数据,在用html和js来显示比较好,至于侧边栏有很多现成的代码,有的就是单单的导航栏,有的是“手风琴效果”的导航栏,楼主可以自己来google 有很多这样的效果
      

  3.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>CSDN论坛导航树</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
    /*<![CDATA[*/
    *{margin:0;padding:0;font:normal 12px/20px Tahoma,sans-serif;}
    body{background:#F6F9FD;padding:0 0 0 5px;}
    input{font:normal 12px verdana,sans-serif;padding:2px 3px;margin:0 0 1px;border:1px solid #CCC;width:194px;color:#CCC;}
    img{vertical-align:middle;}
    td{white-space:nowrap;overflow:hidden;float:left;}
    .hot_search{color:#FF0000;}
    .icon{background:url(/ui/scripts/System/_resource/MzTreeView/file.gif) no-repeat;width:16px;height:16px;cursor:pointer;}
    .folder{background:url(/ui/scripts/System/_resource/MzTreeView/folder.gif) no-repeat;width:16px;height:16px;cursor:pointer;}
    .folderopen{background:url(/ui/scripts/System/_resource/MzTreeView/folderopen.gif) no-repeat;width:16px;height:16px;cursor:pointer;}
    .space{background:url(/ui/scripts/System/_resource/MzTreeView/_line5.gif) no-repeat;width:18px;height:20px;cursor:default;}
    .line1{background:url(/ui/scripts/System/_resource/MzTreeView/_line1.gif) no-repeat;width:18px;height:20px;cursor:default;}
    .line2{background:url(/ui/scripts/System/_resource/MzTreeView/_line2.gif) no-repeat;width:18px;height:20px;cursor:default;}
    .line4{background:url(/ui/scripts/System/_resource/MzTreeView/_line4.gif) no-repeat;width:18px;height:20px;cursor:default;}.minus1{background:url(/ui/scripts/System/_resource/MzTreeView/_minus1.gif) no-repeat;width:18px;height:20px;cursor:pointer;}
    .minus2{background:url(/ui/scripts/System/_resource/MzTreeView/_minus2.gif) no-repeat;width:18px;height:20px;cursor:pointer;}
    .plus1{background:url(/ui/scripts/System/_resource/MzTreeView/_plus1.gif) no-repeat;width:18px;height:20px;cursor:pointer;}
    .plus2{background:url(/ui/scripts/System/_resource/MzTreeView/_plus2.gif) no-repeat;width:18px;height:20px;cursor:pointer;}input:hover,input:focus{background:#ECF6FC;}
    a{text-decoration:none;padding:2px 3px;color:#000060;}
    a:hover{background:#B0D4ED;text-decoration:none;color:#FFF;}
    .linkfocus{background:#FFC;color:#000060;}
    .search_sty{background:#FFF;padding:3px 0 5px 0;border:1px solid #000;width:200px;}
    .loading{background:url(/ui/styles/default/images/loading.gif) no-repeat;width:16px;height:16px;}.item{height:20px;}
    div span.text{}
    div span.notice{color:#D2D2D2}
    div span.functionbtn{color:#999}
    div span.functionbtn a{margin:0 0 0 6px;text-decoration:underline;color:#999;background:none;}
    div span.functionbtn a:hover{text-decoration:none;color:#C30;background:none;}
    div span.book a{margin:0 0 0 6px;text-decoration:none;color:#ffb66b;background:none;}.regard a{color:#993300;font-weight:bold;}
    .star_showpic{background:url(/ui/styles/default/images/star_favpic.png) right no-repeat;height:20px;}
    * html .star_showpic{background:url(/ui/styles/default/images/star_favpic.gif) right no-repeat;height:20px;}
    /*]]>*/
    </style></head>
    <body>
    <input id="input_content" type="hidden" />
    <script type="text/javascript" src="/ui/scripts/CsdnContent.js?version=2010031004"></script>
    <script type="text/javascript">
    var isGuest = false;
    var username = "simaa0106";
    var content = new CsdnContent("CSDN论坛", "CSDN论坛", "../WebNavigation/StaticContents/main.js?version=2010020102", "js", false, true, "ContentFrame", isGuest);
    document.getElementById("input_content").content = content;
    </script>
    </body>
    </html>