JS脚本:
- <%
- dim rs
- dim sql
- dim count
- dim rs1
- dim sql1
- sql = "select * from region order by zoneid asc"
- set rs = server.createobject("adodb.recordset")
- rs.open sql,conn,1,3
- %>
- <script language = "JavaScript">
- var onecount;
- onecount=0;
- subcat = new Array();
- <%
- count = 0
- do while not rs.eof
- %>
- subcat[<%=count%>] = new Array("<%= trim(rs("regionname"))%>","<%= trim(rs("zoneid"))%>","<%= trim(rs("regionid"))%>");
- <%
- count = count + 1
- rs.movenext
- loop
- rs.close
- set rs=nothing
- %>
- onecount=<%=count%>;
- function changelocation(zoneid)
- {
- document.myform.region.length = 0;
- var zoneid=zoneid;
- var i;
- document.myform.region.options[0] = new Option('--地区--','');
- for (i=0;i < onecount; i++)
- {
- if (subcat[i][1] == zoneid)
- {
- document.myform.region.options[document.myform.region.length] = new Option(subcat[i][0], subcat[i][2]);
- }
- }
- }
- </script>
varonecount;
onecount=0;
subcat=newArray();
count=0
dowhilenotrs.eof
%>
subcat[]=newArray("","","");
count=count+1
rs.movenext
loop
rs.close
setrs=nothing
%>
onecount=;
functionchangelocation(zoneid)
{
document.myform.region.length=0;
varzoneid=zoneid;
vari;
document.myform.region.options[0]=newOption('--地区--','');
for(i=0;i { if(subcat[i][1]==zoneid) { document.myform.region.options[document.myform.region.length]=newOption(subcat[i][0],subcat[i][2]); } } }
表单内容: