任意拖放
http://www.15seconds.com/demo/011129/TreeView.html

解决方案 »

  1.   

    添加、删除、移动...
    http://www.15seconds.com/component/pg001037.htm
      

  2.   

    to net_lover 不会吧,是要收费的吗?
      

  3.   

    <%@page import="java.sql.*"%>
    <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 (IE4) {
            write(".child {display:none}")
            }
            write("</STYLE>");
        }
    }function initIt(){
        if (IE4) {
                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 (IE4) {
            whichEl = eval( "Child" + el);
            if (whichEl.style.display == "none") {
                whichEl.style.display = "block";
            }
            else {
                whichEl.style.display = "none";
            }
        }
    }
    onload = initIt;
    </script><SCRIPT language=JavaScript>
    function add()
    {var stt
    stt=""
    for(var i=0;i<document.form2.elements.length;i++)
    {
    var e=document.form2.elements[i];
    if(e.name.indexOf("SelectId")>=0)
    {
      if (e.checked==1) 
    {
       stt=stt+ e.value;
       document.formdown.text1.value=stt; 
       document.formdelete.text.value=stt; 
    }

    }
    } function deleted()
    { if (document.formdelete.text.value=="") {
        alert("请选择要删除的文件");
      }else{  if (confirm("确定从服务器上删除该文件?")){
         formdelete.submit();}
     }
     }
     </SCRIPT><p><%@ include file="dbconnect.jsp"%>
    <%
    try {
    Connection con=DriverManager.getConnection(url);
    Statement stat=con.createStatement();
    String sql=new String();
    sql="select * from project_doc where num="+ "'"+number + "' order by pdoctype";
    ResultSet rs=stat.executeQuery(sql); 
    String Address = new String();int pnum = 1;   //设置父节点的参数out.print("<form name=form2>");
    while (rs.next()){
    String doctype=new String();
    String docname=new String();
    String docAddress=new String();
    String docnum= new String();docnum=rs.getString("docnum");
    doctype=rs.getString("pdoctype");
    docname=rs.getString("pdocname");docAddress=rs.getString("pdocAddress");
    docAddress=docAddress.trim();
    docAddress=docAddress +  docname;String idparent=new String();
    String idchild=new String();idparent="parent"+ String.valueOf(pnum); 
    idchild="Child"+String.valueOf(pnum);    if (!Address.equals(doctype))
    {
       Address = doctype;
       if (pnum !=1)                  %></div><%
    %>
       <div id=<%=idparent%> class="parent"><a href="#" onClick="expandIt('<%=pnum%>')" ><img src="image/plus.gif" border=0>
       <%
       doctype=doctype.trim();
       out.println(doctype);   %></a>
       </div>
    <%  
       
       pnum++;     
       %>
       <div id=<%=idchild%> class="child">
       <%
    }%>
       <img src="image/spacer.gif"  border=0 alt="">  <input type="radio" name="SelectId" value = <%=docnum%> onclick=add()>
      <img src="image/file.gif"  border=0 >
      <a href=<%=docAddress%> target="_blank"><%out.println(docname); %></a><br>
       
    <%     }
    out.print("</div>");
    out.print("</form>");
    rs.close();
    stat.close();
    con.close();
    }catch(SQLException e){
    out.println(e);
    }
    %>
    <form method="post" action="docdelete.jsp" name="formdelete">        
                 <input type="hidden" name="text" >
          <img src="image/gb.gif">
             <a href="javascript:deleted();">从服务器上删除</a> 
    </form>
      

  4.   

    谢谢大家的参与,尤其感谢sunlai(赖),我想用Applet来实现这个tree结构,或者采用jsp+bean的结构来实现,请问哪位可以提供建议.
      

  5.   

    sunlai(赖),能不能给出dbconn.jsp的源代码,可以调试哟下
      

  6.   

    还有哪位做过网页中实现Tree这种动态结构,提提建议呀,或者共享一下你们的思路,当然有代码就更好了.多谢.
      

  7.   

    sunlai(赖),提供一下dbconnect.jsp的代码
      

  8.   

    对啊,对啊,我想用几个Bean来实现这个,已经想了一个月了,可是一个回调函数就是想不通,我也想请哪一位高手指点迷津。