树形目录的递归实现(一)数据库+jsp+javabeanhttp://www.csdn.net/develop/Read_Article.asp?Id=17732

解决方案 »

  1.   

    <html><head><title>tree</title>
     <SCRIPT language=JavaScript> 
    NS4 = (document.layers) ? 1 : 0; 
    IE4 = (document.all) ? 1 : 0; 
    ver4 = (NS4 || IE4) ? 1 : 0; if (ver4) { 
    with (document) { 
    write("<STYLE TYPE='text/css'>"); 
    if (NS4) { 
    write(".parent {position:absolute; visibility:visible}"); 
    write(".child {position:absolute; visibility:visible}"); 
    write(".regular {position:absolute; visibility:visible}") 

    else { 
    write(".child {display:none}") 

    write("</STYLE>"); 

    } function getIndex(el) { 
    ind = null; 
    for (i=0; i<document.layers.length; i++) { 
    whichEl = document.layers[i]; 
    if (whichEl.id == el) { 
    ind = i; 
    break; 


    return ind; 
    } function arrange() { 
    nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height; 
    for (i=firstInd+1; i<document.layers.length; i++) { 
    whichEl = document.layers[i]; 
    if (whichEl.visibility != "hide") { 
    whichEl.pageY = nextY; 
    nextY += whichEl.document.height; 


    } function initIt(){ 
    if (!ver4) return; 
    if (NS4) { 
    for (i=0; i<document.layers.length; i++) { 
    whichEl = document.layers[i]; 
    if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide"; 

    arrange(); 

    else { 
    divColl = document.all.tags("DIV"); 
    for (i=0; i<divColl.length; i++) { 
    whichEl = divColl(i); 
    if (whichEl.className == "child") whichEl.style.display = "none"; 


    } function expandIt(el) { 
    if (!ver4) return; 
    if (IE4) { 
    whichEl = eval(el + "Child"); 
    if (whichEl.style.display == "none") { 
    whichEl.style.display = "block"; 

    else { 
    whichEl.style.display = "none"; 


    else { 
    whichEl = eval("document." + el + "Child"); 
    if (whichEl.visibility == "hide") { 
    whichEl.visibility = "show"; 

    else { 
    whichEl.visibility = "hide"; 

    arrange(); 


    onload = initIt; 
    </SCRIPT>
    <base target="main">
    </head><body>
              <table border="0" width="92">
                  <tr>
                    <td width="82">
                    <table border="0" width="222" height="217">
                  <tr>
                    <TD vAlign=top bgColor=#f7fff7 width="216" height="211">           

    <DIV class=parent id=KB0Parent><A 
                onclick="expandIt('KB0'); return false" 
                href="http://www.tqbooks.com/#"><IMG height=22 
                src="plus1.gif" width=20 
                border=0>JAVA</A></DIV>
                <DIV class=child id=KB0Child style="width: 110; height: 156">&nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">J2SE</A><BR>
                              &nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:">J2EE/EJB</A><BR>&nbsp<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">JSP</A><BR>&nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:"></A>J2ME<BR>
                              &nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:">设计模式</A><BR>
                &nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                href="http:">SUN JAVA</A><BR> 
                &nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">非技术区</A></DIV>

              <DIV class=parent id=KB1Parent><A 
                onclick="expandIt('KB1'); return false" 
                href="http://www.tqbooks.com/#"><IMG height=22 
                src="plus1.gif" width=20 
                border=0>DELGHI</A></DIV>
                <DIV class=child id=KB1Child style="width: 110; height: 156">&nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">基础类</A><BR>
                              &nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:">非技术区</A><BR>&nbsp<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">DATABASE</A><BR>
                              &nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:"></A>GAME<BR>
                              &nbsp;<IMG 
                height=15 src="plus2.gif" width=15><A 
                href="http:">VCL</A><BR>
                              &nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                href="http:">网络编程</A><BR>
                              &nbsp;<IMG height=15 
                src="plus2.gif" width=15><A 
                            href="http:">图形处理</A>
                            </DIV>           </TD></tr>
                </table>
              </body>
      

  2.   

    up
    [email protected]
    我也想要,谢谢!