JS 脚本:
<%
Dimrs
DimSQL
Dimcount
dimrs1
DimSQL1
sql = "select*fromregionorderbyzoneidasc"
setrs = server.createObject ("adodb.recordset")
Rs.opensql, Conn, 1,3
%>
<scriptlanguage = "javascript">
varonecount;
OneCount = 0;
subcat = newarray ();
<%
count = 0
Dowhilenotrs.eof
%>
subcat [<%= count%>] = newarray ("<%= trim (rs (" regionname "))%>", "<%= trim (rs (" ZoneID "))%>", "<%= trim (rs (" regionId "))%>");
<%
count = count+1
Rs.movenext
петля
Rs.close
setrs = ничего
%>
OneCount = <%= count%>;
functionChangeLocation (ZoneID)
{
document.myform.region.length = 0;
varzoneid = ZoneId;
vari;
document.myform.region.options [0] = newoption ('-地区-', '');
для (i = 0; i <onecount; i ++)
{
if (subcat [i] [1] == ZoneId)
{
document.myform.region.options [document.myform.region.length] = newoption (subcat [i] [0], subcat [i] [2]);
}
}
}
</script>
表单内容:
<Таблица>
<форма>
<tr>
<Td>
<spanclass = "style1">*</span> 大区 :
<selectname = "Zone" size = "1" ID = "Zone" OnChange = "Changelocation (document.myform.zone.options [document.myform.zone.selectedIndex] .value)">
<optionvalue = 0selected> 请选择 </option>
<%
sql1 = "select*frombigzoneorderbyzonenameasc"
setrs1 = server.createObject ("adodb.recordset")
rs1.opensql1, conn, 1,3
%>
<%whilenotrs1.eof%>
<optionvalue = "<%= rs1 (" ZoneID ")%>"> <%= rs1 ("ZoneName")%> </option>
<%rs1.movenext
Венд
rs1.close
setrs1 = ничего
%>
</select> </td>
<tdwidth = "20%"> <spanclass = "style1">*</span> 地区 :
<selectname = "region" size = "1" id = "region">
<optionvalue = 0selected> 请选择 </option>
</select>
</tr>
</form>
</table>