JS 脚本:
<%
Dimrs
dimsql
DimCount
DIMRS1
dimsql1
SQL = "Selecione*FromRegionOrdyZoneidasc"
setrs = server.createObject ("adodb.recordset")
Rs.opensql, Conn, 1,3
%>
<scriptLanguage = "javascript">
VaroneCount;
ONECOUNT = 0;
subcat = newArray ();
<%
contagem = 0
Dowhilenotrs.eof
%>
subcat [<%= count%>] = newArray ("<%= TRIM (rs (" RegionName "))%>", "<%= TRIM (rs (" zoneId "))%>", "<%= TRIM (rs (" RegionID "))%>");
<%
contagem = contagem+1
rs.movenext
laço
rs.close
setrs = nada
%>
OneCount = <%= contagem%>;
FunctionChangelocation (ZoneID)
{
document.myform.region.length = 0;
varzoneId = zoneID;
vari;
document.myform.region.options [0] = newOption ('-'-',' ');
para (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>
表单内容:
<tabela>
<morm>
<tr>
<Td>
<spanclass = "style1">*</span> 大区:
<selectName = "zone" size = "1" id = "zone" onchange = "changelocation (document.myform.zone.options [document.myform.zone.selectedIndex] .value)">
<OptionValue = 0Selected> 请选择 </pption>
<%
sql1 = "Selecione*FromBigZoneOrderByZoneNameasc"
setrs1 = server.createObject ("adodb.recordset")
rs1.opensql1, Conn, 1,3
%>
<%whilenotrs1.eof%>
<pptionValue = "<%= rs1 (" zoneId ")%>"> <%= rs1 ("zoneName")%> </pption>
<%rs1.movenext
Wend
rs1.close
setrs1 = nada
%>
</leclect> </td>
<tdwidth = "20%"> <spanclass = "style1">*</span> 地区:
<selectName = "Region" size = "1" Id = "Region">
<OptionValue = 0Selected> 请选择 </pption>
</leclect>
</tr>
</morm>
</tabela>