请教如何在网页中实现TreeView的问题,欢迎大家参与! 任意拖放http://www.15seconds.com/demo/011129/TreeView.html 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 添加、删除、移动...http://www.15seconds.com/component/pg001037.htm to net_lover 不会吧,是要收费的吗? <%@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 sttstt=""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> 谢谢大家的参与,尤其感谢sunlai(赖),我想用Applet来实现这个tree结构,或者采用jsp+bean的结构来实现,请问哪位可以提供建议. sunlai(赖),能不能给出dbconn.jsp的源代码,可以调试哟下 还有哪位做过网页中实现Tree这种动态结构,提提建议呀,或者共享一下你们的思路,当然有代码就更好了.多谢. sunlai(赖),提供一下dbconnect.jsp的代码 对啊,对啊,我想用几个Bean来实现这个,已经想了一个月了,可是一个回调函数就是想不通,我也想请哪一位高手指点迷津。 IE9下取不到值这是怎么了?? jstl是怎么实现的? 很不解,希望能得到答案…… 下拉框Option的value值能否用函数 编码问题(高分) 【200分】:过虑器、监听器问题请教 高手进来看看, 在线等, 完了马上结贴. 如何产生随机密码?(在线等待,着急中。。。。。) 天啊,真的都是一群菜鸟吗???给点爱心吧!!!!!!!-------weblogic6.1环境下,import一个包,在编译时出错,提示找不到!为什么??(详情进入) JRUN一定要与APACHE在同一计算机上吗? 请诸位高手帮帮忙! 象CSDN这样的树形结构的控件是怎么实现的,有源代码吗
http://www.15seconds.com/component/pg001037.htm
<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>