以下是二级动态菜单为什么点了没反应请问是哪出问题了!! 谢了
表名:type_tree ——父类
字段:type_id(自动编号) type_name(类别名称)
表名:s_type ——子类
字段:id(自动编号) s_name(子类别名称) type_id(父类ID)——与父类表相对应
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>动态二级菜单</title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript" type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location="+selObj.options[selObj.selectedIndex].value+""
;
if (restore) selObj.selectedIndex=0;
}
-->
</script>
</head>
<BODY BGCOLOR="#FFFFFF" ONLOAD="MM_jumpMenu()">
<select name="first" onChange="MM_jumpMenu(parent,this,0)">
<%
sql = "select [type_id],[type_name] from [type_tree]"
set rs=server.CreateObject("adodb.recordset"
rs.open sql,conn,1,3
'set rs = conn.execute(sql)'取得父类的ID及名称
response.Write(rs("type_name"
)
if rs.eof then 'or rs.bof
response.write "<option>-----</option>" '如果没有记录,就显示-----
else
while not(rs.eof or rs.bof) '有记录,就将父名称列出来,形成下拉。
response.write ("<option value=?sec=" & rs(0) & ""
if cstr(rs(0)) = request.querystring("sec"
then
response.write "selected"
end if
response.write (">" & rs(1) & "</option>"
rs.movenext
wend
rs.movefirst '将游标移到第一条,以备下面之用。
end if
%>
</select>
<select name="second">
<%if rs.eof or rs.bof then
response.write ("<option>--------</option>"
else
if request.querystring("sec"
= "" then '获取跳转之后的sec值
temp=rs(0)'如果为空,就把temp的值设为第一条记录的值
else
temp = request.querystring("sec"
'否则就为收到的值%>
<%end if
subsql = "select [s_name] from [s_type] where type_id="&temp&""
set subrs = conn.execute(subsql) '列出一切资料为temp的记录
if subrs.eof or subrs.bof then
response.write ("<option>-----</option>"
'如果没有记录,则在这个列表中显示"-----"
else
while not(subrs.eof or subrs.bof)'否则就用循环列出一切符合条件的记录。
response.write ("<option value=" & subrs(0) & ">" & subrs(0) & "</option>"
subrs.movenext
wend
end if
end if
'[关闭所有的记录集
subrs.close
set subrs = nothing
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
</select>
</body>
</html>