ASP三级菜单成数据库读取数据后添加资料时都是第一级的值,怎么回事。
<%
dim conn
dim rs_1
dim sql_1
dim count
dim rs1
dim sql1
dim rs2
dim sql2
dim count2
dim connstr
sql_1 = "select * from ld order by pid desc"
set rs_1 = conn.execute(sql_1)
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs_1.eof
%>
subcat[<%=count%>] = new Array("<%=trim(rs_1("ld"))%>","<%= trim(rs_1("pid"))%>","<%= trim(rs_1("pid"))%>");
<%
count = count + 1
rs_1.movenext
loop
rs_1.close
set rs_1=nothing
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.class2.length = 0;
document.myform.class3.length = 0;
document.myform.class3.options[0] = new Option('==请选择电梯==','');
var locationid=locationid;
var i;
document.myform.class2.options[0] = new Option('==请选择楼栋==','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.class2.options[document.myform.class2.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<%sql2 = "select * from dt order by pid3 asc"
set rs2 = conn.execute(sql2)
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("pid2"))%>","<%= trim(rs2("pid3"))%>","<%= trim(rs2("pid3"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>;
function changelocation2(villageid)
{
document.myform.class3.length = 0;
var villageid=villageid;
var j;
document.myform.class3.options[0] = new Option('==请选择电梯==','');
for (j=0;j < onecount2; j++)
{
if (subcat2[j][1] == villageid)
{
document.myform.class3.options[document.myform.class3.length] = new Option(subcat2[j][0], subcat2[j][2]);
}
}
}
</script>
</head>
<body>
<form action="app3.asp" method="post" name="myform" enctype="multipart/form-data">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
楼盘名称:
<select name="class1" class="input">
<option selected value="">==请选择楼盘==</option>
<%
sql1 = "select * from lp order by id desc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=rs1("id")%>"><%=rs1("mc")%></option>
<%
rs1.movenext
loop
rs1.close
%>
</select>
</div></td>
<td><div align="center">
楼栋:
<select name="class2" class="input">
<option selected value="">==请选择楼栋==</option>
</select>
</div></td>
<td><div align="center">
电梯号:
<select name="class3" class="input">
<option selected value="">==请选择电梯==</option>
</select>
</div></td>
<td><div align="center">
<label>
位置: </label>
<label>
<input name="class4" type="text" id="class4" size="20">
</label>
<input name="sjid" type="hidden" id="sjid" value="<%=request("id")%>">
<input name="class5" type="hidden" id="class5" value="<%=request("name")%>">
</div></td>
<td><div align="center">
<input type="submit" name="Submit" value="提交">
</div></td>
</tr>
</table>
</form> |