当前位置 : 主页 > 编程语言 > java >

二级联动菜单——ASP+数据库版

来源:互联网 收集:自由互联 发布时间:2022-07-22
!--#include file="../include/buyok_shop_30_conn.asp"-- script language = "javascript" var j; j=0; goaler = new Array(); %set rs=conn.execute("select * from newsclass where classid0 order by ID")'二级菜单 if rs.eof then% goaler[0] = new
<!--#include file="../include/buyok_shop_30_conn.asp"-->
<script language = "javascript">
var j;
j=0;
goaler = new Array();
<%set rs=conn.execute("select * from newsclass where classid<>0 order by ID")'二级菜单
if rs.eof then%>
goaler[0] = new Array("无分类","","");
<%else
i=0
do while not rs.eof%>
goaler[<%=i%>] = new Array("<%=rs("minclassname")%>","<%=rs("classid")%>","<%=rs("ID")%>");//classid为一级的ID,ID为自己的ID
<%rs.movenext
i=i+1
loop
end if
rs.close
%>
j=<%=i%>;function changelocation(locationid)
{
document.addnews.SmallClassID.length = 0;var locationid=locationid;
var i;
for (i=0;i < j; i++)
{
if (goaler[i][1] == locationid)
{
document.addnews.SmallClassID.options[document.addnews.SmallClassID.length] = new Option(goaler[i][0], goaler[i][2]);
}
}}
</script><form method="post" name="addnews" action="">
<select name="BigClassID" onChange="changelocation(document.addnews.BigClassID.options[document.addnews.BigClassID.selectedIndex].value)" size="1">
<%set rs=conn.execute("select * from newsclass where classid=0 order by ID")'一级
if rs.eof then%>
<option selected value="">无一级分类</option>
<%else%>
<option selected value="">请选择一级分类</option>
<%do while not rs.eof%>
<option value="<%=rs("ID")%>"><%=rs("classname")%></option>
<%rs.movenext
loop
end if%>
</select>
<select name="SmallClassID">
<option selected value="">未指定一级分类</option>
</select>
<input type="submit" name="goaler" value="提交">
</form> <%'测试取值
if request("goaler")<>"" then
response.write "ID="&request("ID")&"<BR>ID="&request("ID")
end if%>
上一篇:POJ3040给奶牛发工资
下一篇:没有了
网友评论