documen.form.select_comcode.options为空或不是对象
<%///////////////////////////公司二级联动///////////////////////////////////
dim countc
Set rsgs = Server.CreateObject("ADODB.Recordset")
sql = "select unique comcode,comsname,uppercomcode from comcode where comtype[1] in ('1','2') order by 1"
set rsgs=conn.execute(sql)
//response.Write(rsgs(1))
%>
<script language = "JavaScript">
var onecountc;
onecountc=0;
subcatc = new Array();
<%
countc = 0
do while not rsgs.eof
%>
subcatc[<%=countc%>] = new Array("<%= trim(rsgs("comsname"))%>","<%= trim(rsgs("uppercomcode"))%>","<%= trim(rsgs("comcode"))%>");
<%
countc = countc + 1
rsgs.movenext
loop
rsgs.close
%>
onecountc=<%=countc%>;
function changelocationc(locationidc)
{
document.form.select_depart.options[0]=new Option("请选择下级公司","");
document.form.select_depart.length = 1;
var locationidc=locationidc;
var i;
for (i=0;i < onecountc; i++)
{
if (subcatc[i][1] == locationidc)
{
document.form.select_depart.options[document.form.select_depart.length] = new Option(subcatc[i][0], subcatc[i][2]);
}
}
}
</script>
以下是表格中
<td colspan="2" valign="middle" ><span class="STYLE7"><font color="#000000">公司
<select name="select_comcode" id="select_comcode" onChange="changelocationc(document.form.select_comcode.options[document.form.select_comcode.selectedIndex].value)">
<option value="all" selected>全部</option>
<% Set rs4 = Server.CreateObject("ADODB.Recordset")
sql="select comcode,comsname,comgrade from comcode where comgrade='4' and comtype[1]<>'3' "&whr_coma&" order by 1"
rs4.open sql,conn,1,3
For i = 1 to rs4.recordcount
If rs4.EOF Then Exit For
response.write("<option value="&rs4("comcode")&">"&rs4("comsname")&"</option>")
rs4.movenext
next
rs4.close
%>
</select>
</font>
<font color="#000000">
<label></label>
<select name="select_depart" id="select_depart">
<option value="全部" selected>--请选择部门--</option>
</select>
我想实现select_comcode和select_depart的二级联动,可是总是提示documen.form.select_comcode.options为空或不是对象这个错误,这个表单的id和name都是form,确认过没有错
求助是哪里不对,要怎么改?
------解决方案--------------------
自己一步一步调试。。慢慢的就会找到答案的