大类表:id(编号) board(大类名)
小类表:id(编号) city_name(小类名) board_id(所属大类ID)
<script language="JavaScript">
<!--
var subcat = new Array();
<%
exec="select id,city_name,board_id from city"
set ors=server.createobject("adodb.recordset")
ors.open exec,conn,1,1
dim n
n=0
do while not ors.eof
%>
subcat[<%=n%>] = new Array('<%=trim(ors("board_id"))%>','<%=trim(ors("city_name"))%>','<%=trim(ors("id"))%>')<%
ors.movenext
n=n+1
loop
ors.close
set ors=nothing
%>
function changeselect(selectValue)
{
document.form.Shop_Road.length = 0;
document.form.Shop_Road.options[0] = new Option('请选择小类','');
for (i=0; i<subcat.length; i++)
{
if (subcat[i][0] == selectValue)
{
document.form.Shop_Road.options[document.form.Shop_Road.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
-->
</script>
<%
exec="select id,board from board"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<select name="Shop_Area" onChange="changeselect(this.value)">
<option value="" selected>请选择大类</option>
<%
do while not rs.eof%>
<option value=<%=rs("id")%>><%=rs("board")%></option>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
<select name="Shop_Road">
</select>
现在的问题是:选取大类后,小类没有反应
[此贴子已经被作者于2007-1-24 11:25:49编辑过]