<!--#include file="conn.asp"-->
<%
dim cid,coid
cid = request("cid") 'cid 大类id
coid = request("coid") 'coid 中类id
set rs=server.createobject("adodb.recordset")
sql = "select * from edu_c" '表一 大类表
rs.open sql,conn,1,1
stroption1 = "<option value='' selected >==请选择所属市局==</option>"
do while not rs.eof
if cstr(rs("id")) = cstr(cid) then
stroption1 = stroption1 & "<option value='" & rs("id") & "' selected>" & rs("c_name") & "</option>"
else
stroption1 = stroption1 & "<option value='" & rs("id") & "'>" & rs("c_name") & "</option>"
end if
rs.movenext
loop
rs.close
if cid <> "" then
sql = "select * from edu_co where c_id=" & cid '表二 中类表 bid==表一中的id
rs.open sql,conn,1,1
stroption2 = "<option value='' selected >==请选择所属县局==</option>"
do while not rs.eof
if cstr(rs("id")) = cstr(coid) then
stroption2 = stroption2 & "<option value='" & rs("id") & "' selected>" & rs("co_name") & "</option>"
else
stroption2 = stroption2 & "<option value='" & rs("id") & "'>" & rs("co_name") & "</option>"
end if
rs.movenext
loop
rs.close
end if
if coid <> "" then
sql = "select * from edu_s where co_id= " & coid '表三 小类表 mid==表二的id
rs.open sql,conn,1,1
stroption3 = "<option value='' selected >==请选择学校==</option>"
while not rs.eof
if cstr(rs("id")) = cstr(sid) then
stroption3 = stroption3 & "<option value='" & rs("id") & "' selected>" & rs("s_name") & "</option>"
else
stroption3 = stroption3 & "<option value='" & rs("id") & "'>" & rs("s_name") & "</option>"
end if
rs.movenext
wend
rs.close
end if
%>
<select onChange="changeb(this.value)" name="cid"><%=stroption1%></select>
<select onChange="change(this.value)" name="coid"><%=stroption2%></select>
<select name="sid"><%=stroption3%></select>
<script language="javascript">
<!--
function changeb(cid){
location.assign("bb.asp?action=s_s&cid=" + cid);
}
function change(coid){
location.assign("bb.asp?action=s_s&cid=<%=cid%>&coid=" + coid);
}
-->
</script>