我现在想要个三级的,就是选定大类小类自动出现所有属于这个大类的小类,然后在这里面选定小类以后,三级类别,所有属于这个小类的所以三级类被自动选定,类似小类的功能..
我现在把二级类的代码和函数公布一下,大家帮忙改一下..
var onecount; onecount=0; subcat = new Array(); <% count = 0 do while not rs.eof %> subcat[<%=count%>] = new Array("<%= trim(rs("sorts"))%>","<%= rs("categoryid")%>","<%= rs("sortsid")%>"); <% count = count + 1 rs.movenext loop rs.close %> onecount=<%=count%>;
function changelocation(locationid) { document.myform.sortsid.length = 0;
var locationid=locationid; var i; for (i=0;i < onecount; i++) { if (subcat[i][1] == locationid) { document.myform.sortsid.options[document.myform.sortsid.length] = new Option(subcat[i][0], subcat[i][2]); } } } <% rs.open "select * from category order by categoryorder",conn,1,1 if rs.eof and rs.bof then response.write "没有东西!" response.end else %> <select name="categoryid" size="1" id="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)"> <option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option> <% dim selclass selclass=rs("categoryid") rs.movenext do while not rs.eof %> <option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option> <% rs.movenext loop end if rs.close %> </select> 所属小类 <select name="sortsid"> <% rs.open "select * from sorts where categoryid="&selclass ,conn,1,1 if not(rs.eof and rs.bof) then %> <option selected value="<%=rs("sortsid")%>"><%=rs("sorts")%></option> <% rs.movenext do while not rs.eof %> <option value="<%=rs("sortsid")%>"><%=rs("sorts")%></option> <% rs.movenext loop end if rs.close rs.open "select * from TimesProList",conn,1,1 %> </select> 大家帮忙改一下..