<script language="JavaScript">
<!--
var subcat = new Array();
<%
dim hit_jj_h
hit_jj_h=0
Call OpenDatabase()
set jrs=createobject("adodb.recordset")
jrs.open "select distinct(item_name) as c from KJXMGL ",conn,1,3
if jrs.eof then
%>
subcat[0] = new Array('0','0','0')
<%
jrs.close
set jrs=nothing
else
do while not jrs.eof
set jj=createobject("adodb.recordset")
jj.open "select distinct(Speciality) as b from KJXMGL where item_name='" & jrs("c") & "' ",conn,1,3
if jj.eof then
jj.close
set jj=nothing
else
do while not jj.eof
%>
subcat[<%=hit_jj_h%>] = new Array('<%=jrs("c")%>','<%=jj("b")%>','<%=jj("b")%>')
<%
hit_jj_h=hit_jj_h+1
jj.movenext
loop
jj.close
set jj=nothing
end if
jrs.movenext
loop
jrs.close
set jrs=nothing
end if
%>
function changeselect1(locationid)
{
document.pxfrom1.end_port.length = 0; //初始化下拉列表 清空下拉数据
for (i=0; i<subcat.length; i++) //legth=20
{
if (subcat[i][0] == locationid) //[0] [1] 第一列 第二列
{document.pxfrom1.end_port.options[document.pxfrom1.end_port.length] = new Option(subcat[i][1], subcat[i][2]);} //建立option
//第一次 length=1 因为有==请选择==
//i=9时 length= 10 值有11个 因为从0数起 subcat[i][0] == locationid屏蔽了再写
}
document.pxfrom1.end_port.value="";
}
//-->
</script>
<form action="123.asp" method="post" name="pxfrom1">
<select name="item_name" onChange="changeselect1(this.value)" style="width:120px">
<option value="">-请选择-</option>
<%
set rs=createobject("adodb.recordset")
rs.open "select distinct(item_name) as c from KJXMGL ",conn,1,3
if rs.eof then
response.write"无申报项目"
rs.close
set rs=nothing
else
c_value_first=rs("c")
do while not rs.eof
%>
<option value="<%=rs("c")%>"><%=rs("c")%></option>
<%
rs.movenext
loop
rs.close
set rs=nothing
end if
%>
</select>
<select name="Speciality" style="width:120px">
<option>==请选择==</option>
<%if session("Speciality")<>"" then%>
<option value="<%=session("Speciality")%>" selected><%=session("Speciality")%></option>
<%else%>
<option>此项目无对应的专业</option>
<%
end if %>
</select>
</form>
二级联动下拉第二个为什么不是默认的指教一下
二级联动下拉第二个下拉菜单不是默认的 请指教一下
红色的ELSE 也不能判断请指教