日期:2014-05-17  浏览次数:20803 次

我有两个asp 的下拉选择控件select,我是通过下面的数组把它遍历出来的。
我有两个asp 的下拉选择控件select,我是通过下面的数组把它遍历出来的。

i=i+1
field(i,1)="所属类别"
field(i,2)="categoryID"
field(i,3)="int"
field(i,4)="select_Parent"
field(i,5)="qunzuID"

i=i+1

field(i,1)="所属群组"
field(i,2)="qunzuID"
field(i,3)="int"
field(i,4)="select_Category"

第一个select它绑定的值是在inclue文件夹的function.asp的文件里面
if field(num,4)="select_Parent" and field(num,3)="int" then
  response.write "<select name="&field(num,2)&" id="&field(num,2)&" size=1 style=""width:120px;"">"
 
dim liebieid
sSql="select id,name from "&tablename2&" where id="&request("CatID")&" order by sortindex,id desc"
set rsParent=conn.execute(ssql)
liebieid=rsParent("ID")
while not rsParent.eof
If Cstr(rsParent("ID")&"") = cstr(field(num,0)&"") Then
Response.Write "<option value=""" & rsParent("ID") & """ selected>" & rsParent("Name") & "</option>"
Else
Response.Write "<option value=""" & rsParent("ID") & """>" & rsParent("Name")& "</option>"
End If

rsParent.movenext
wend
rsParent.close
set rsParent=nothing
response.write "</select>"
end if

我想通过选中上面第一个select的值,然后通它的值作为条件查询数据库赋给第二个select,也就是说每当我第一个select选项变时,第二个select的下拉值会跟着变。目前我卡在怎么判断第一个select已经被选择中了呢?谢谢你们的准确回答啊!


------解决方案--------------------
在select的onchange事件中获得当前选中的option的value