asp关联二级菜单问题
该代码只能看大类的列表,小类的看不到,请各位大侠指点一下,运行成功后我会追加100分!<!--#includefile="conn.asp"--><html><%dimc...
该代码只能看大类的列表,小类的看不到,请各位大侠指点一下,运行成功后我会追加100分!
<!--#include file="conn.asp" -->
<html>
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from shop_nclass order by nclassidorder"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("nclass"))%>","<%= trim(rs("anclassid"))%>","<%= trim(rs("nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.sid.options[document.form1.sid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table border="0" width="100%" id="table1" cellpadding="4" style="border:1px solid #183789; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px">
<form action=save.asp method=post name=form1 onSubmit="return checkdata();">
<tr>
<td width="100%" colspan="2" background="Image/admin_bg_1.gif" height="25">
<font color="#FFFFFF"><b>商品发布:</b></font></td>
</tr>
<tr>
<td width="168">所属分类:</td>
<td width="802"><select size="1" name="bid" onChange="changelocation(document.form1.bid.options[document.form1.bid.selectedIndex].value)">
<option>≡≡请选择大类≡≡</option>
<%sql="select anclassid,anclass from shop_anclass order by anclassidorder"
set rs=conn.execute (sql)
set id=rs("anclassid")
set big_class=rs("anclass")
do while not rs.eof
%>
<option value="<%= trim(rs("anclassid"))%>"><%= trim(rs("anclass"))%></option>
<%rs.movenext
loop
%>
</select> <select name="sid" onChange="change(document.form1.sid.options[document.form1.sid.selectedIndex].value)" style='width:147;background-color:white;font-size:12;color:black; height:18' size="1">
<option selected>≡≡请选择小类≡≡</option></select></td>
</form>
</table>
</body>
</html>
我要的是点击选择大类后,从小类里面出来与之相关的小类列表!大家多多帮忙,没啥说的,加分! 展开
<!--#include file="conn.asp" -->
<html>
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from shop_nclass order by nclassidorder"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("nclass"))%>","<%= trim(rs("anclassid"))%>","<%= trim(rs("nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.sid.options[document.form1.sid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table border="0" width="100%" id="table1" cellpadding="4" style="border:1px solid #183789; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px">
<form action=save.asp method=post name=form1 onSubmit="return checkdata();">
<tr>
<td width="100%" colspan="2" background="Image/admin_bg_1.gif" height="25">
<font color="#FFFFFF"><b>商品发布:</b></font></td>
</tr>
<tr>
<td width="168">所属分类:</td>
<td width="802"><select size="1" name="bid" onChange="changelocation(document.form1.bid.options[document.form1.bid.selectedIndex].value)">
<option>≡≡请选择大类≡≡</option>
<%sql="select anclassid,anclass from shop_anclass order by anclassidorder"
set rs=conn.execute (sql)
set id=rs("anclassid")
set big_class=rs("anclass")
do while not rs.eof
%>
<option value="<%= trim(rs("anclassid"))%>"><%= trim(rs("anclass"))%></option>
<%rs.movenext
loop
%>
</select> <select name="sid" onChange="change(document.form1.sid.options[document.form1.sid.selectedIndex].value)" style='width:147;background-color:white;font-size:12;color:black; height:18' size="1">
<option selected>≡≡请选择小类≡≡</option></select></td>
</form>
</table>
</body>
</html>
我要的是点击选择大类后,从小类里面出来与之相关的小类列表!大家多多帮忙,没啥说的,加分! 展开
2个回答
展开全部
<!--#include file="conn.asp" -->
<html>
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from shop_nclass order by nclassidorder"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">扮码
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("nclass"))%>","<%= trim(rs("anclassid"))%>","<%= trim(rs("nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.sid.options[document.form1.sid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table border="0" width="100%" id="table1" cellpadding="4" style="border:1px solid #183789; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px">
<form action=save.asp method=post name=form1 onSubmit="return checkdata();">
<tr>
<td width="100%" colspan="2" background="Image/admin_bg_1.gif" height="25">
<font color="#FFFFFF"><b>商品发布:</b></font></td>
</tr>
<tr>
<td width="168">所属分类:</td>
<td width="802"><select size="1" name="bid" onChange="changelocation(document.form1.bid.options[document.form1.bid.selectedIndex].value)">
<option>≡≡请选择大类≡≡</option>
<%sql="select anclassid,anclass from shop_anclass order by anclassidorder"
set rs=conn.execute (sql)
set id=rs("anclassid")
set big_class=rs("anclass")
do while not rs.eof
%>
<option value="<%= trim(rs("anclassid"))%>"><%= trim(rs("anclass"))%></option>
<%rs.movenext
loop
%>
</培缺团select> <select name="sid" onChange="change(document.form1.sid.options[document.form1.sid.selectedIndex].value)" style='width:147;background-color:white;font-size:12;color:black; height:18' size="1">
<option selected>≡≡请选择小类≡≡</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>配橘</td>
</form>
</table>
</body>
</html>
把1、2、3改成你需要添加的内容就行!
<html>
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from shop_nclass order by nclassidorder"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">扮码
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("nclass"))%>","<%= trim(rs("anclassid"))%>","<%= trim(rs("nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.sid.options[document.form1.sid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table border="0" width="100%" id="table1" cellpadding="4" style="border:1px solid #183789; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px">
<form action=save.asp method=post name=form1 onSubmit="return checkdata();">
<tr>
<td width="100%" colspan="2" background="Image/admin_bg_1.gif" height="25">
<font color="#FFFFFF"><b>商品发布:</b></font></td>
</tr>
<tr>
<td width="168">所属分类:</td>
<td width="802"><select size="1" name="bid" onChange="changelocation(document.form1.bid.options[document.form1.bid.selectedIndex].value)">
<option>≡≡请选择大类≡≡</option>
<%sql="select anclassid,anclass from shop_anclass order by anclassidorder"
set rs=conn.execute (sql)
set id=rs("anclassid")
set big_class=rs("anclass")
do while not rs.eof
%>
<option value="<%= trim(rs("anclassid"))%>"><%= trim(rs("anclass"))%></option>
<%rs.movenext
loop
%>
</培缺团select> <select name="sid" onChange="change(document.form1.sid.options[document.form1.sid.selectedIndex].value)" style='width:147;background-color:white;font-size:12;color:black; height:18' size="1">
<option selected>≡≡请选择小类≡≡</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>配橘</td>
</form>
</table>
</body>
</html>
把1、2、3改成你需要添加的内容就行!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询