以下是改造的代码清单
<script language=javascript>
function ShowLayer(index)
{
if(this.Layer(index).style.display=="none")
{
this.Layer(index).style.display="block";
}
else
{
this.Layer(index).style.display="none";
}
}
</script>
<table border="1" style="border-collapse: collapse" width="6%" id="table1">
<%
Dim rsA'主菜单记录集
Dim rsB'子菜单记录集
Dim i
i=0
set rsA=server.createobject("adodb.recordset")
sql="select * from user_1"
rsA.open sql,conn,1,1
Do Until rsA.EOF
With Response
.Write "<tr>"
.Write " <td><a href=# onclick=ShowLayer("&i&"); >"&rsA("username")&"</a></td>"
.Write "</tr>"
set rsB=server.createobject("adodb.recordset")
sql="select * from user_jg where username_1='"&rsA("username")&"'"
rsB.open sql,conn,1,1
.Write" <td>"
.Write" <div style=display:none; id=Layer>"
IF Not rsB.EOF Then
.Write "<select size='1' name='D1'>"
Do Until rsB.EOF
rsB.MoveNext
Loop
.Write "</select>"
End IF
rsB.close
set rsB=nothing
.Write " </div>"
.Write " </td>"
.Write "</tr>"
End With
rsA.MoveNext
i=i+1
Loop
%>
</table>