<!--#include file="conn.inc"-->
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000" background="../../BJ/BJ4.JPG"><script language="JavaScript">
<!--
var onecount
onecount=0
var subcat = new Array();
// set conn = server.CreateObject("adodb.recordset") //这句打开网页就什么都不显示了
<%
sql = "select * from 机构 where 机构名称 = '部门' order by 上级机构代码 asc"
set rs =conn.execute(sql)
%>
<%
count = 0
do while not rs.eof
%>
// response.write "subcat["& count &"] = new Array(""" & rs("上级机构代码") & """,""" & rs("机构名称") """);" //两种赋值方法都好像不起作用
subcat[<%=count%>] = new Array("<%=trim(rs("上级机构代码"))%>","<%=trim(rs("机构名称"))%>");
<%
count=count+1
rs.movenext
loop
set rs=nothing
%>
onecount=<%=count%> ;
// response.write "onecount = " & count &" ;"function changeselect(locationid)
{
document.form1.s2.length = 0;
document.form1.s2.options[0] = new Option('===请选择===','');
for (i=0; i<subcat.length; i++)
{
if (subcat[i][0] == locationid)
{document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][1]);} //建立option
}
}
//-->
</script><form name="form1">
<table width="500" border="4" align="center">
<tr align="center">
<td width="90">使用机关</td>
<td width="190" height="22">
<select name="s1" onChange="changeselect(this.value)">
<option>==请选择==</option>
<option value= ""></option>
<%
str="select * from [机构] where [机构].[机构标志]='机关' order by 机构代码 asc"
set rs= conn.execute(str)
do while not rs.eof%>
<option value="<%=trim(rs("机构代码"))%>"><%=trim(rs("机构名称"))%></option>
<%rs.movenext
loop
rs.close
%>
</select>
</td>
<td width="90" height="22" >使用部门</td>
<td width="190" height="22">
<select name="s2" >
<option>==请选择==</option>
<option value= ""></option>
</select>
</td>
</tr>
</table>
</form>
</html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000" background="../../BJ/BJ4.JPG"><script language="JavaScript">
<!--
var onecount
onecount=0
var subcat = new Array();
// set conn = server.CreateObject("adodb.recordset") //这句打开网页就什么都不显示了
<%
sql = "select * from 机构 where 机构名称 = '部门' order by 上级机构代码 asc"
set rs =conn.execute(sql)
%>
<%
count = 0
do while not rs.eof
%>
// response.write "subcat["& count &"] = new Array(""" & rs("上级机构代码") & """,""" & rs("机构名称") """);" //两种赋值方法都好像不起作用
subcat[<%=count%>] = new Array("<%=trim(rs("上级机构代码"))%>","<%=trim(rs("机构名称"))%>");
<%
count=count+1
rs.movenext
loop
set rs=nothing
%>
onecount=<%=count%> ;
// response.write "onecount = " & count &" ;"function changeselect(locationid)
{
document.form1.s2.length = 0;
document.form1.s2.options[0] = new Option('===请选择===','');
for (i=0; i<subcat.length; i++)
{
if (subcat[i][0] == locationid)
{document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][1]);} //建立option
}
}
//-->
</script><form name="form1">
<table width="500" border="4" align="center">
<tr align="center">
<td width="90">使用机关</td>
<td width="190" height="22">
<select name="s1" onChange="changeselect(this.value)">
<option>==请选择==</option>
<option value= ""></option>
<%
str="select * from [机构] where [机构].[机构标志]='机关' order by 机构代码 asc"
set rs= conn.execute(str)
do while not rs.eof%>
<option value="<%=trim(rs("机构代码"))%>"><%=trim(rs("机构名称"))%></option>
<%rs.movenext
loop
rs.close
%>
</select>
</td>
<td width="90" height="22" >使用部门</td>
<td width="190" height="22">
<select name="s2" >
<option>==请选择==</option>
<option value= ""></option>
</select>
</td>
</tr>
</table>
</form>
</html>
自己对比下有什么不同。
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("徐汇区","01","001");
subcat[1] = new Array("嘉定区","01","002");
subcat[2] = new Array("黄浦区","01","003");
subcat[3] = new Array("南昌市","02","004");
subcat[4] = new Array("九江市","02","005");
subcat[5] = new Array("上饶市","02","006");onecount=6;function changelocation(locationid)
{
document.myform.smalllocation.length = 0; var locationid=locationid;
var i;
document.myform.smalllocation.options[0] = new Option('====所有地区====','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
} //-->
</script>
</head>
<body>
<form name="myform" method="post" action="../house/list.asp">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
<option value="01" selected>上海</option>
<option value="02">江西</option>
</select>
<select name="smalllocation">
<option selected value="">==所有地区==</option>
</select>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value);
//-->
</script>
</body>
</html>
<%
set cnn=server.CreateObject ("adodb.connection")
set rs=server.createobject("adodb.recordset")
cnn.open application("connectionstring")
%>
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
subcat = new Array();
<%
strsql = "select * from tblbureau where 1=1 "
if session("middle_bureau")<>"" then
strsql = strsql & " and middle_bureau='" & session("middle_bureau") & "'"
end if
if session("essential_bureau")<>"" then
strsql = strsql & " and essential_bureau='" & session("essential_bureau") & "'"
end if
set rs =cnn.execute(strsql)
dim i
i=0
do while not rs.eof %>
subcat[<%=i%>] = new Array("<%=rs("essential_bureau")%>","<%=rs("middle_bureau")%>","<%=rs("essential_bureau")%>");<%
i=i+1
rs.movenext
loop
%>
onecount=<%=i%>; function changelocation(locationid)
{
document.frmsetup.essential_bureau.length = 0;
var locationid=locationid;
var i;
document.frmsetup.essential_bureau.options[0] = new Option('请选择','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.frmsetup.essential_bureau.options[document.frmsetup.essential_bureau.length] = new Option(subcat[i][0], subcat[i][2]);
}
} }
//-->
</script>
<form name=frmsetup>
<tr class=tb2>
<td width="15%" class=t1> 所在区</td>
<td width="35%" class=t1> <select size="1" name="settle_region" class=f1 onChange="changelocation(document.frmsetup.settle_region.options(document.frmsetup.settle_region.selectedIndex).value)">
<option value="">请选择</option>
<option value="罗湖">罗湖</option>
<option value="福田">福田</option>
<option value="南山">南山</option>
<option value="盐田">盐田</option>
<option value="宝安">宝安</option>
<option value="龙岗">龙岗</option>
</select>
</td>
<td width="15%" class=t1> 所在所</td>
<td width="35%" class=t1> <select size="1" name="essential_bureau" class=f1>
<option value="">请选择</option>
</select>
</td>
</tr>
<script LANGUAGE="javascript">
<!--
changelocation(document.frmsetup.settle_region.options(document.frmsetup.settle_region.selectedIndex).value)
//-->
</script>
</form>