'=============二级联动选择的主程序
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from AllShop order by ShopID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("ShopCode"))%>","<%= trim(rs("ShopName"))%>","<%= trim(rs("ShopCode"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.ShopCode.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.ShopCode.options[document.myform.ShopCode.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
function loadForm()
{
editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
return true
}
</script>
<table>
<tr>
<td>商品名称:
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from AllShop"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加商品。"
else
%>
<select class="editbox" name="ShopName" onChange="changelocation(document.myform.ShopName.options[document.myform.ShopName.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("ShopName"))%>"><%=trim(rs("ShopName"))%></option>
<%
dim selclass
selclass=rs("ShopName")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("ShopName"))%>"><%=trim(rs("ShopName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<select class="editbox" name="ShopCode">
<option value="" selected>商品代码</option>
<%
sql="select * from AllShop where ShopName='" & selclass & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("ShopCode")%>"><%=rs("ShopCode")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("ShopCode")%>"><%=rs("ShopCode")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
</table>