我要导出一组相关数据 就象是 宿舍名字和里面住的人的名字
要求从两个表中 导出宿舍名和对应里面住的人的名字 类似下拉菜单的样子导出 要怎么实现呢
图 - 102 (宿舍名字)
A (人名)
B
C
- 103
C
D
+ 104
+ 105
+ 106 (注:点宿舍前面的名字的+ 显示相应宿舍的人)
以下是从数据库里提出数据做成下拉菜单的主体程序
<%
set myrs_root=server.CreateObject("adodb.recordset")
myrs_root.Open "select handbook_id ,handbook_title from t_handbook where handbook_parentid=0 order by class asc",conn,1,1
'i=myrs_root.RecordCount
function UpdateStr1(str) '转化字符串
str = Replace(str,"\","\\")
str = Replace(str,"'","\'")
UpdateStr1 = str
end function
%>
<SCRIPT language="JavaScript">
function display1(Q_subtree,Q_img){
if (Q_subtree.style.display=="none"){
Q_subtree.style.display="";
Q_img.src="../images/tree_collapse.gif";
}
else
{
Q_subtree.style.display="none";
Q_img.src="../images/tree_expand.gif";
}
}
function del_sort(temp,tag){
if(tag=="Yes"){
var msg=window.confirm ("该目录下的产品也会被删除,\n你真的要删除该目录吗?");
if(msg==true){
document.delform.id.value=temp;
document.delform.submit();
}
}
else
alert("该目录下还有子目录,不能删除!");
}
function chang_news_sort(id,handbook_title,level_name){
document.frm_edit.handbook_id.value=id;
document.frm_edit.handbook_title.value=handbook_title;
document.frm_edit.level_name.value=level_name;
document.frm_edit.old_handbook_title.value=handbook_title;
}
</SCRIPT>
<TABLE cellSpacing=0 cols=5 cellPadding=0 width=300 border=0>
<TBODY>
<form name="delform" action="sort_ok_NEW.asp?version=<%=current_ver%>" method="post">
<TR>
<TD style="line-height:16px" width=16></TD>
<TD style="line-height:16px" width=16></TD>
<TD style="line-height:16px" width=15></TD>
<TD style="line-height:16px" width="230"></TD>
<TD style="line-height:16px" width=23></TD>
</TR>
<TR>
<TD style="line-height:16px" width="16"><IMG src="../images/tree_collapse.gif" border=no></TD>
<TD style="line-height:16px" colSpan=4>目录名 删除</TD>
</TR>
<%n=1
for i=1 to myrs_root.RecordCount
set myrs_child=server.CreateObject("adodb.recordset")
myrs_child.Open "select handbook_id,handbook_title from t_handbook where handbook_parentid=" & myrs_root("handbook_id") & " order by seat_id",conn,1,1
if myrs_child.RecordCount=0 then
%>
<TR>
<TD style="line-height:16px" width="16"><IMG src="../images/<%if i=myrs_root.RecordCount then%>tree_end.gif<%else%>tree_split.gif<%end if%>"></TD>
<TD style="line-height:16px" width="16"><IMG src="../images/tree_leaf.gif" border=0 width="15" height="16"></TD>
<TD style="line-height:16px" colSpan=2><A href="#here" onclick="javascript:chang_news_sort('<%=myrs_root("handbook_id")%>','<%=UpdateStr1(myrs_root("handbook_title"))%>','root');"><%=myrs_root("handbook_title")%></A></TD>
<TD style="line-height:16px" width="23"> </TD>
</TR>
<%else%>
<TR>
<TD style="line-height:16px" width="16"><img src="../images/<%if i=myrs_root.RecordCount then%>tree_end.gif<%else%>tree_split.gif<%end if%>" border=no width="16" height="16"></TD>
<TD style="line-height:16px" width="16"><SPAN id=zhugan<%=n%> style="CURSOR: hand;" onclick="javascript:display1(document.all.subtree<%=n%>,document.all.img<%=n%>);"><IMG src="../images/tree_collapse.gif" border=no name=img<%=n%>></SPAN></TD>
<TD style="line-height:16px" colSpan=2><A href="#here" onclick="javascript:chang_news_sort('<%=myrs_root("handbook_id")%>','<%=UpdateStr1(myrs_root("handbook_title"))%>','root');"><%=myrs_root("handbook_title")%></A></TD>
<TD style="line-height:16px" width="23"> </TD>
</TR>
<TR id="subtree<%=n%>"><TD style="line-height:16px" colspan=5>
<TABLE cellSpacing=0 cols=5 cellPadding=0 width=100% border=0>
<tbody>
<%for j=1 to myrs_child.RecordCount%>
<TR>
<TD style="line-height:16px" width="16"><%if i=myrs_root.RecordCount then%> <%else%><img src="../images/tree_vertline.gif" border=0><%end if%></TD>
<TD style="line-height:16px" width="16"><IMG src="../images/<%if j=myrs_child.RecordCount then%>tree_end.gif<%else%>tree_split.gif<%end if%>"></TD>
<TD style="line-height:16px" width="15"><img src="../images/tree_leaf.gif" border=0 width="15" height="16"></TD>
<TD style="line-height:16px" width="230"><A href="#here" onclick="javascript:chang_news_sort('<%=myrs_child("handbook_id")%>','<%=UpdateStr1(myrs_child("handbook_title"))%>','child');"><%=myrs_child("handbook_title")%></a></TD>
<TD style="line-height:16px" width="23"><a href="javascript:del_sort('<%=myrs_child("handbook_id")%>','Yes')"><b>×</b></a></TD>
</TR>
<%myrs_child.MoveNext
if myrs_child.EOF then exit for
next%></tbody>
</TABLE></TD>
</TR>
<%end if%>
<% myrs_child.Close
set myrs_child=nothing
myrs_root.MoveNext
if myrs_root.EOF then exit for
n=n+1
next
myrs_root.Close
set myrs_root=nothing
%>
<input type="hidden" name="id"><input type="hidden" name="sort_action" value="del">
</form>
</TBODY>
</TABLE>