JS脚本:
<%
薄暗い
dimsql
薄暗い
dimrs1
dimsql1
sql = "select*fromegionorderbyzoneidasc"
setrs = server.createObject( "adodb.recordset")
rs.opensql、conn、1,3
%>
<ScriptLanguage = "JavaScript">
varonecount;
onecount = 0;
subcat = newArray();
<%
count = 0
dowhileenotrs.eof
%>
subcat [<%= count%>] = newArray( "<%= trim(rs(" regionname "))%>"、 "<%= trim(rs(" zoenid "))%>"、 "<%= trim(" 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( ' - 地区 - '、 '');
for(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>
表单内容:
<表>
<form>
<tr>
<td>
<spanclass = "style1">*</span>大区:
<selectName = "ゾーン" size = "1" id = "ゾーン" onchange = "changelocation(document.myform.zone.options [document.myform.zone.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>