急急....求教一下的这段二级菜单连动为什么不行,对你们来说应该很简单
页面中有两个表单一个是下拉的,另一下不是下拉的
现在想达到这个功能:就是下拉表单一下,第二个表单的内容就自动跳出来,也就是说,第二个表单的内容是根据第一表单的下拉查询数据库,找到对应的内容
第一个表单name及id是f_voy(数据库中对应字段voy),第二个表单name及id是edt_pol(数据库中对应字段VV_ETD)
下面贴出代码
<script language="JavaScript">
<!--
var onecount2;
onecount2=0;
subcat2=new Array();
<%
sql2="Select VV_ETD,voy from c_vesvoy order by voy"
set obj2=AccessConn.execute(sql2)
j=0
do while not obj2.eof
%>
subcat2[<%=j%>]=new Array("<%=trim(obj2("voy"))%>","<%=trim(obj2("VV_ETD"))%>");
<%
j=j+1
obj2.movenext
loop
obj2.close
set obj2=nothing
%>
onecount2=<%=j%>;
function changelocation2(voy)
{
var voy =document.getElementById("f_voy").options[document.getElementById("f_voy").selectedIndex].value;
var voy=voy;
var n;
alert(document.getElementById("f_voy").value);
for (n=0;n<onecount2;n++)
{
if (subcat2[n][0].toString().substring(0,0)==voy.substring(0,1))
{
// document.form1.edt_pol.value=new subcat[n][1])
document.getElementById("edt_pol").value=new subcat2[n][1]);
}
}
}
//-->
</script>