大家好,有个问题想请教下,我有个二级连动菜单,是下拉的,现在想把第二联改成复选框的,哪位大哥大姐帮下忙。谢谢了!
数据库中有表SmallClass (字段有SmallClassID,SmallClassName,BigClassName)
和表SSmallClass(字段有SSmallClassID,SSmallClassName,SmallClassName)
源代码:
<script language="javascript" >
<!--
<%
Dim rsa,sqla
set rsb=server.createobject("adodb.recordset")
sqlb = "select * from SmallClass where BigClassName= '"&"外语考试辅导"&" '"
rsb.open sqlb,conn,1,1
set rs=server.createobject("adodb.recordset")
sql = "select * from SSmallClass"
rs.open sql,conn,1,1
% >
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
% >
subcat[ <%=count% >] = new Array(" <%= trim(rs("SSmallClassName"))% >"," <%= trim(rs("SmallClassName"))% >"," <%= trim(rs("SSmallClassName"))% >");
<%
count = count + 1
rs.movenext
loop
rs.close
% >
onecount= <%=count% >;
function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
-- >
</script >
<form name="myform" method="post" action="Enshop.asp" >
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1" >
<option selected value="" >请选择课程类别 </option >
<%
if not (rsb.bof and rsb.eof) then
rsb.movefirst
do while not rsb.eof
response.Write " <option value= '" & trim(rsb("SmallClassName")) & " ' >" & trim(rsb("SmallClassName")) & " </option >"
rsb.movenext
loop
end if
rsb.close
% >
</select >
<select name="SmallClassName" >
<option selected value="" >请选择课程 </option >
</select >