如何实现树形结构? csdn上搜索的好象都是固定的,不是用数据库形式的,但假如数据多了就不知怎么办了,可以用xml,javascript,+asp/jsp,但还没有成功,想想办法,一起努力吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我要一个,学习学习,[email protected]Thanks! 15seconds.com英文的,搜索tree。 能不能也给我一份?谢谢!!![email protected] 我也来个mail:[email protected] http://www.fangfa.net/temp/tv102.exeTreeView类,1.02版!2.0版制作中 我也来个[email protected]谢谢! me!me! i wanna get some one..email:[email protected] <!----#include file="conn.asp"-------><head><link rel="stylesheet" type="text/css" href="style.css"><title>分层</title></head><base target="main.asp"><body topmargin="0" leftmargin="0" bgcolor="#7285CF"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr><td height="20"></td></tr> <tr> <td width="100%" height="281" valign="top"><DIV id=cItem> <% I=0'取第一层内容 sql = "Select * from first order by id" Set Rs = Conn.Execute(sql) if not rs.eof then do while not rs.eof'判断该记录是否为终结点 SQL2 = "Select * From second Where fcode='" & Rs("code") & "' order by id" Set Rs2 = Conn.Execute(SQL2)%> <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3"> <tr> <%if Rs2.eof then%> <td width="5%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td> <td width="95%" style="cursor:Hand" valign="top"><a href="main.asp?code=<%=Rs("code")%>" target=main><% = Rs("name") %></a></td> <%response.write "</tr></table>"%> <% else %> <td width="5%"> <p align="right"><img src="Images/Close.gif" id="Out1<%=I+1%>" style="cursor:Hand" class=cItem align="absbottom" width="9" height="9"></p> </td> <td width="95%" id="Out1<%=I+1%>"><% = Rs("name") %></td></tr></table> <div id="Out1<%=I+1%>a" style="display:None"> <%'取第二层内容 J=0 do while not Rs2.eof'判断该记录是否为终结点 SQL3 = "Select * From third Where scode='" & Rs2("code") & "' order by id" Set Rs3 = Conn.Execute(SQL3)%> <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3"> <tr> <%if Rs3.eof then%> <td width="10%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td> <td width="90%" style="cursor:Hand"><a href="main.asp?code=<%=Rs2("code")%>" target=main><% = Rs2("name") %></a></td> <%response.write "</tr></table>"%> <% else %> <td width="10%"> <p align="right"><img src="Images/Close.gif" id="Out2<%=I%><%=J+1%>" style="cursor:Hand" class=cItem align="absbottom" width="9" height="9"></p> </td> <td width="95%" id="Out2<%=I%><%=J+1%>"><% = Rs2("name") %></td></tr></table> <div id="Out2<%=I%><%=J+1%>a" style="display:None"><%do while not Rs3.eof%><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3"> <tr> <td width="15%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td> <td width="85%" style="cursor:Hand"><a href="main.asp?code=<%=Rs3("code")%>" target=main><% = Rs3("name") %></a></td> </tr></table><% Rs3.movenext loop%></div><% End if J=J+1 Rs2.movenext loop%></div><% end if I=I+1 Rs.movenext loop end if Conn.Close%></div> <script><!--function DynamicFunc(){ var tID, sTAG, tTag; sTAG = window.event.srcElement; if (sTAG.className == "cItem"){ tID = sTAG.id + "a"; tTag = document.all(tID); if (tTag.style.display == "none") { tTag.style.display = ""; sTAG.src = "Images/Open.gif"; } else { tTag.style.display = "none"; sTAG.src = "Images/Close.gif"; }}}cItem.onclick = DynamicFunc; //--></script></body></html> <html><body><table> <tr><td>1</td><td>树木1</td><tr> <tr><td>2</td><td>树木2</td><tr> <tr style="cursor:hand;" ><td valign=top>3</td><td id="test"><div onclick='opentree()'>树木3</div></td><tr></table></body></html><script language="javascript"> function opentree() { document.all.test.innerHTML = "<table><tr><td onclick='javascript:closetree()'>树木3</td><tr><tr><td>1</td><td>叶子</td><tr></table>" } function closetree() { document.all.test.innerHTML ="<div onclick='opentree()'>树木3</div>"; }</script>这段代码简单了一点,大致思路就是这样,通过innerHTML代替就可以实现了,当然这是最简单的方法。你可以自己试试看这段代码,我刚写的一棵树也是这么做的! 求一个Google map的多标记例子。 把1输出为0001 关于JavaScript的问题 在静态的html页面中去调用一js文件,调用完不会刷新界面 能否通过把Dll文件打包成cab文件,然后客户端通过js调用dll 求 js分享功能 可带视频分享的 如何:做url向上一层的正则表达式 请教:如何实现在网页上导出excel(office97,2000,2003)都能用。 一个简单的问题,关于下拉列表的用法? open新窗口后如何控制原来的窗口(马上给分) 一个输入判断的问题! 如何实现以下javascript的网页特效?在线等,急!
Thanks!
[email protected]
mail:[email protected]
2.0版制作中
[email protected]
谢谢!
email:[email protected]
<link rel="stylesheet" type="text/css" href="style.css"><title>分层</title></head>
<base target="main.asp">
<body topmargin="0" leftmargin="0" bgcolor="#7285CF"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr><td height="20"></td></tr>
<tr>
<td width="100%" height="281" valign="top">
<DIV id=cItem>
<%
I=0'取第一层内容
sql = "Select * from first order by id"
Set Rs = Conn.Execute(sql)
if not rs.eof then
do while not rs.eof
'判断该记录是否为终结点
SQL2 = "Select * From second Where fcode='" & Rs("code") & "' order by id"
Set Rs2 = Conn.Execute(SQL2)
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3">
<tr>
<%if Rs2.eof then%>
<td width="5%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td>
<td width="95%" style="cursor:Hand" valign="top"><a href="main.asp?code=<%=Rs("code")%>" target=main><% = Rs("name") %></a></td>
<%response.write "</tr></table>"%>
<%
else
%>
<td width="5%">
<p align="right"><img src="Images/Close.gif" id="Out1<%=I+1%>" style="cursor:Hand" class=cItem align="absbottom" width="9" height="9"></p>
</td>
<td width="95%" id="Out1<%=I+1%>"><% = Rs("name") %></td></tr></table>
<div id="Out1<%=I+1%>a" style="display:None">
<%
'取第二层内容
J=0
do while not Rs2.eof
'判断该记录是否为终结点
SQL3 = "Select * From third Where scode='" & Rs2("code") & "' order by id"
Set Rs3 = Conn.Execute(SQL3)
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3">
<tr>
<%if Rs3.eof then%>
<td width="10%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td>
<td width="90%" style="cursor:Hand"><a href="main.asp?code=<%=Rs2("code")%>" target=main><% = Rs2("name") %></a></td>
<%response.write "</tr></table>"%>
<%
else
%>
<td width="10%">
<p align="right"><img src="Images/Close.gif" id="Out2<%=I%><%=J+1%>" style="cursor:Hand" class=cItem align="absbottom" width="9" height="9"></p>
</td>
<td width="95%" id="Out2<%=I%><%=J+1%>"><% = Rs2("name") %></td></tr></table>
<div id="Out2<%=I%><%=J+1%>a" style="display:None">
<%do while not Rs3.eof%>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#DEE2F3">
<tr>
<td width="15%"><p align="right"><img src="Images/end.gif" align="absbottom" width="9" height="9"></p></td>
<td width="85%" style="cursor:Hand"><a href="main.asp?code=<%=Rs3("code")%>" target=main><% = Rs3("name") %></a></td>
</tr>
</table>
<%
Rs3.movenext
loop
%></div>
<%
End if
J=J+1
Rs2.movenext
loop
%>
</div>
<%
end if
I=I+1
Rs.movenext
loop
end if
Conn.Close
%>
</div>
<script><!--
function DynamicFunc()
{
var tID, sTAG, tTag;
sTAG = window.event.srcElement;
if (sTAG.className == "cItem")
{
tID = sTAG.id + "a";
tTag = document.all(tID);
if (tTag.style.display == "none")
{
tTag.style.display = "";
sTAG.src = "Images/Open.gif";
}
else
{
tTag.style.display = "none";
sTAG.src = "Images/Close.gif";
}
}
}
cItem.onclick = DynamicFunc;
//-->
</script></body>
</html>
<body>
<table>
<tr><td>1</td><td>树木1</td><tr>
<tr><td>2</td><td>树木2</td><tr>
<tr style="cursor:hand;" ><td valign=top>3</td><td id="test"><div onclick='opentree()'>树木3</div></td><tr>
</table>
</body>
</html>
<script language="javascript">
function opentree()
{
document.all.test.innerHTML = "<table><tr><td onclick='javascript:closetree()'>树木3</td><tr><tr><td>1</td><td>叶子</td><tr></table>"
}
function closetree()
{
document.all.test.innerHTML ="<div onclick='opentree()'>树木3</div>";
}
</script>这段代码简单了一点,大致思路就是这样,通过innerHTML代替就可以实现了,当然这是最简单的方法。你可以自己试试看这段代码,我刚写的一棵树也是这么做的!