网上用的比较多的asp级联菜单效果代码

2018-09-06 13:10

阅读:399

  复制代码 代码如下:
<!--#includefile=conn.asp-->
<html>
<head>
<metahttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<metaname=GENERATORcontent=MicrosoftFrontPage4.0>
<metaname=ProgIdcontent=FrontPage.Editor.Document>
<title>NewPage1</title>
</head>
<body>
<%
dimrs
dimsql
dimcount
setrs=server.createobject(adodb.recordset)
sql=select*fromshiinfoorderbyidasc
rs.opensql,conn,1,1
%>

<SCRIPTlanguage=JavaScript>
varonecount;
onecount=0;
subcat=newArray();
<%
count=0
dowhilenotrs.eof
%>
subcat[<%=count%>]=newArray(<%=trim(rs(shiname))%>,<%=trim(rs(shengcode))%>,<%=trim(rs(id))%>);
<%
count=count+1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
functionchangelocation(locationid)
{
document.form1.cid.length=0;
varlocationid=locationid;
vari;
for(i=0;i<onecount;i++)
{
if(subcat[i][1]==locationid)
{
document.form1.cid.options[document.form1.cid.length]=newOption(subcat[i][0],subcat[i][2]);
}
}
}

</SCRIPT>
<SCRIPTlanguage=javascript>
<!--
functionCheckForm()
{
document.form1.txtcontent.value=document.form1.doc_html.value;
returntrue
}
//-->
</SCRIPT>
<formname=form1onsubmit=check()>
省份<%
sql=select*fromshenginfo
rs.opensql,conn,1,1
ifrs.eofandrs.bofthen
response.write请先添加省份。
response.end
else
%>
<Selectname=sidonChange=changelocation(document.form1.sid.options[document.form1.sid.selectedIndex].value)><%
dowhilenotrs.eof
%><OPTIONselectedvalue=<%=trim(rs(id))%>><%=trim(rs(shengname))%></OPTION>
<%
rs.movenext
loop
endif
rs.close
%>
</Select>
城市:<Selectname=cid>
<OPTIONselectedvalue=>==请选城市==</OPTION>
</Select>
</form>
</body>
</html>


评论


亲,登录后才可以留言!