asp+javascript做一个可以动态的显示、折叠的表,急!

jingyuanlin 2004-12-22 01:47:07
结构如此:
- 功能一
- 子功能A
编码1 名称1 用途1
编码2 名称2 用途2
+ 子功能B
+ 功能二
虽然看起来很像树形结构,但是要求动态的,而且能有展开/收起的区分,明细中要用表格显示,数据库表中,功能和子项是分开两个表的

这个到底能用什么办法解决呢?
...全文
170 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
nik_Amis 2004-12-23
  • 打赏
  • 举报
回复
up
jingyuanlin 2004-12-23
  • 打赏
  • 举报
回复
<%
Set rs = Server.CreateObject("ADODB.Recordset")
selectstrclass="select * from DB_invclass where left(icid,2)='10' order by icid "
'response.write selectstrclass
rs.open selectstrclass,conb2b

strToPrint = strToPrint & " <table width=500 cellpadding=0 cellspacing=0 border=0> " & VBCrlf
strToPrint = strToPrint & " <tr>" & VBCrlf
strToPrint = strToPrint & " <td colspan=3>+ 成品</td></tr>" & VBCrlf
do until rs.eof
strToPrint = strToPrint & " <tr>" & VBCrlf

strToPrint = strToPrint & " <td colspan=3>    + " & rs("icid") & " </td></tr>" & VBCrlf

selectstrinv="select * from DB_inventory where icid='"& rs("icid") &"'"
set rsinv=server.createobject("ADODB.recordset")
rsinv.open selectstrinv,conb2b
i=1
do until rsinv.eof
strToPrint = strToPrint & " <tr>" & VBCrlf
if i=1 then
strToPrint = strToPrint & " <td width=30>      </td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #999999 1px solid; BORDER-TOP: #999999 1px solid; "">" & rsinv("iid") & "</td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #999999 1px solid;BORDER-RIGHT: #999999 1px solid;BORDER-TOP: #999999 1px solid; "">" & rsinv("imainuse") & "</td>" & VBCrlf
else
strToPrint = strToPrint & " <td width=30>      </td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #999999 1px solid; "">" & rsinv("iid") & "</td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #999999 1px solid;BORDER-RIGHT: #999999 1px solid; "">" & rsinv("imainuse") & "</td>" & VBCrlf
end if
strToPrint = strToPrint & " </tr>" & VBCrlf
i=i+1
rsinv.movenext
loop

rs.movenext
loop
rsinv.close
set rsinv=nothing
rs.close
set rs=nothing
Set rs = Server.CreateObject("ADODB.Recordset")
strToPrint = strToPrint & " <tr>" & VBCrlf
strToPrint = strToPrint & " <td>+ 物料</td></tr>" & VBCrlf
selectstrclass="select * from DB_invclass where left(icid,2)='11' order by icid"
rs.open selectstrclass,conb2b
do until rs.eof
strToPrint = strToPrint & " <tr>" & VBCrlf

strToPrint = strToPrint & " <td colspan=3>    + " & rs("icid") & " </td>" & VBCrlf

selectstrinv="select * from DB_inventory where icid='"& rs("icid") &"'"
set rsinv=server.createobject("ADODB.recordset")
rsinv.open selectstrinv,conb2b

do until rsinv.eof
strToPrint = strToPrint & " <tr>" & VBCrlf
strToPrint = strToPrint & " <td width=30>      </td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-TOP: #999999 1px solid; "">" & rsinv("iid") & "</td><td width=100 style="" BORDER-LEFT: #999999 1px solid; BORDER-TOP: #999999 1px solid; "">" & rsinv("imainuse") & "</td>" & VBCrlf
strToPrint = strToPrint & " </tr>" & VBCrlf
rsinv.movenext
loop

strToPrint = strToPrint & " </tr>" & VBCrlf

rs.movenext
loop
rsinv.close
set rsinv=nothing
rs.close
set rs=nothing

%>
<html>
<LINK href="/wwlabcrm/include/main.css" rel=stylesheet type=text/css>
<table border=1>
<% = strToPrint %>
</table>
</html>

这是我的asp部分的代码,我的树大概就是这个样子,要怎么改呢?
arrowy 2004-12-23
  • 打赏
  • 举报
回复
用表格:
Table A-----------------------------------
| Table A 的TR1| 一级功能XX |
-----------------------------------------
| Table A 的TR2| Table B ->一级功能子功能|
_________________________________________

显示的时候Table B的style.display是none 即不显示,点[一级功能]就让Table B 的style.display为block就可以了.

做出列表要用个递归,依此把每个有子功能的功能下的所有子功能都归到一个表格里
jingyuanlin 2004-12-23
  • 打赏
  • 举报
回复
能说得详细一点吗?我对js不熟悉
jingyuanlin 2004-12-23
  • 打赏
  • 举报
回复
这个能用在动态的上面么?我每次要自动去取
parent.document.all.here.innerHTML = "<table><tr><td>asdfasdfasdf</td></tr></table>"
这个应该是在javascript中的吧

978107 2004-12-23
  • 打赏
  • 举报
回复
可以将执行代码 放在一个iframe中运行,然后在运行后,将输出数据重新写入到父页的位置.

parent.document.all.here.innerHTML = "<table><tr><td>asdfasdfasdf</td></tr></table>"
jingyuanlin 2004-12-23
  • 打赏
  • 举报
回复
写FUNCTION改HTML元素的DOM对象的INNERHTML属性,怎么样的函数呢?不懂呀
esper 2004-12-23
  • 打赏
  • 举报
回复
写FUNCTION改HTML元素的DOM对象的INNERHTML属性.当在子功能A旁边的展开标记上点击的时候把表格的记录用RECORDSET提出来填到表格标签里放在子功能A的INNERHTML属性里(可以设置表格的位置属性).
jingyuanlin 2004-12-23
  • 打赏
  • 举报
回复
up
everyday1212 2004-12-22
  • 打赏
  • 举报
回复
用layer的none和block属性控件
life360 2004-12-22
  • 打赏
  • 举报
回复
搜索树型菜单
jingyuanlin 2004-12-22
  • 打赏
  • 举报
回复
up

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧