求助,求救,二级级联下拉表成功,但无法取得value写记录
大类表type 结构ID TYPE_NAME名 level=1为一级菜单小类表class 结构ID CLASS_NAME名 FATHER父级即大类表对应 ID
需要在选择了大类小类后,大类小类ID在提交表单时写入记录。现在无法获取到对应ID,
If Request("Action")="Upload" Then
做了人二级级联下拉表,提交表单后怎样拿到二级级联的VALUE呢?????????要写入数据库记录大类和小类
Upload()-----------------在接到UPLOAD的action后执行写记录
%>
<script language="javascript">location.href="MyFiles.asp?action=Main";</script>
<%
End If
Private Function Upload()
…………………………
级联下拉表代码及表单如下:
<form action="?action=Upload" method="post" enctype="multipart/form-data" id="UpLoad_Form" Name="UpLoad_Form">
<%
dim count
set rs=server.createobject("adodb.recordset")
citysql="select * from class order by id asc"
rs.Open citysql,Conn,1,1
%>
<script language="javascript">
var onecount;
onecount=0;
subcat=new Array();
<%
count=0
do while not rs.eof
%>
subcat[<%=count%>]=new Array('<%=rs("class_name")%>','<%=rs("father")%>','<%=rs("id")%>')
<%
count=count+1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changeInput(inputv)
{
var input=inputv;
}
function changelocation(locationid)
{
document.UpLoad_Form.proid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1]==locationid)
{
document.UpLoad_Form.proid.options[document.UpLoad_Form.proid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<form action="?action=Upload" method="post" enctype="multipart/form-data" id="UpLoad_Form" Name="UpLoad_Form">
<%
dim rs,provincesql
Set rs = Server.CreateObject("ADODB.Recordset")
provincesql ="SELECT * From type where level=1 Order By id asc"
rs.open provincesql,Conn,1,1
%>
<select name="typeid" id="typeid" onChange="changelocation(document.UpLoad_Form.typeid.options[document.UpLoad_Form.typeid.selectedIndex].value)">
<option value="<%=rs("id")%>"><%=rs("type_name")%></option>
<%
dim selclass
selclass=rs("id")
rs.movenext
do while not rs.eof
%>
<option value=<%=rs("id")%>> <%=rs("type_name")%></option>>
<%
rs.movenext
loop
rs.close
%>
</select>
<select name="proid" id="proid" onChange="changeInput(document.UpLoad_Form.proid.options[document.UpLoad_Form.proid.selectedIndex].value)">
<%
rs.open "select * from class where father="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("id")%>"><%=rs("class_name")%></option>
<%
dim stypeid
stypeid=rs("id")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("id")%>"><%=rs("class_name")%></option>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</select>