<%sqlstr="select*fromprolei"setrs=conn.execute(sqlstr)setrs1=server.CreateObject("adodb.recordset")sqlstr1="select*fromsecleiorderbyprolei_iddesc"setrs1=conn.execute(sqlstr1)setrs2=conn.execute("selec" />

asp实现三级联动表单

系统 1603 0
< ! -- #includefile = " conn.asp " -->
< %sqlstr = " select*fromprolei "
set rs = conn.execute(sqlstr)
set rs1 = server.CreateObject( " adodb.recordset " )
sqlstr1
= " select*fromsecleiorderbyprolei_iddesc "
set rs1 = conn.execute(sqlstr1)
set rs2 = conn.execute( " select*fromendleiorderbyseclei_iddesc " )
%
>
< scriptlanguage = " JavaScript " >
varonecount;
onecount
= 0 ;
subcat
= new Array ();
< %
CountLinkAction
= 0
do while not rs1.eof
%
>
subcat[
< % = CountLinkAction% > ] = new Array ( " <%=trim(rs1( " seclei " ))%> " , " <%=trim(rs1( " prolei_id " ))%> " , " <%=trim(rs1( " id " ))%> " );
// subcat[ < % = CountLinkAction% > ] = new Array ( " <%=trim(rs1( " seclei " ))%> " , " <%=trim(rs1( " prolei_id " ))%> " );
< %
CountLinkAction
= CountLinkAction + 1
rs1.movenext
loop
rs1.close
set rs1 = nothing
%
>
onecount
=< % = CountLinkAction% > ;
function changelocation(locationid)
{
document.form1.selectlei2.length
= 0 ;
varlocationid
= locationid;
vari;
document.form1.selectlei2.options[
0 ] = new Option ( ' 请选择小类','');
for (i = 0 ;i < onecount;i ++ )
{
if (subcat[i][ 1 ] == locationid)
{
document.form1.selectlei2.options[document.form1.selectlei2.length]
= new Option (subcat[i][ 0 ],subcat[i][ 2 ]);
}
}
}
</ script >
< scriptlanguage = " JavaScript " >
varonecount1;
onecount1
= 0 ;
subcat1
= new Array ();
< %
CountLinkAction1
= 0
do while not rs2.eof
%
>
subcat1[
< % = CountLinkAction1% > ] = new Array ( " <%=trim(rs2( " endlei " ))%> " , " <%=trim(rs2( " seclei_id " ))%> " );
< %
CountLinkAction1
= CountLinkAction1 + 1
rs2.movenext
loop
rs2.close
set rs2 = nothing
%
>
onecount1
=< % = CountLinkAction1% > ;
function changelocation1(locationid1)
{
document.form1.selectlei3.length
= 0 ;
varlocationid1
= locationid1;
varj;
document.form1.selectlei3.options[
0 ] = new Option ( ' 请选择子类','');
for (j = 0 ;j < onecount1;j ++ )
{
if (subcat1[j][ 1 ] == locationid1)
{
document.form1.selectlei3.options[document.form1.selectlei3.length]
= new Option (subcat1[j][ 0 ],subcat1[j][ 0 ]);
}
}
}
</ script >
< formname = " form1 " method = " post " action = " send.asp " onSubmit = " returncheckadd() " >
< tablewidth = " 95% " align = " center " cellpadding = " 5 " cellspacing = " 1 " bgcolor = " A4B6D7 " >
< trbgcolor = " ECF5FF " >
< tdwidth = " 20% " height = " 30 " align = " right " bgcolor = " ECF5FF " > 所属类别: </ td >
< TDwidth = " 80% " >
< select name = " selectlei " class = " input " onChange = " changelocation(document.form1.selectlei.options[document.form1.selectlei.selectedIndex].value) " >
< option selected > 请选择大类 </ option >
< % do while not rs.eof
response.write(
" <optionvalue= " & rs( " id " ) & " > " & rs( " prolei " ) & " </option> " )
rs.movenext
loop % >
</ select >
< select name = " selectlei2 " class = " input " id = " selectlei2 " onChange = " changelocation1(document.form1.selectlei2.options[document.form1.selectlei2.selectedIndex].value) " >
< option selected > 请选择小类 </ option >
</ select >
< select name = " selectlei3 " class = " input " id = " selectlei3 " >
< option selected > 请选择子类 </ option >
</ select >
</ TD >
</ tr >
< trbgcolor = " ECF5FF " >
< tdheight = " 30 " align = " right " bgcolor = " ECF5FF " > </ td >
< tdbgcolor = " ECF5FF " >
< inputname = " Submit " type = " submit " class = " button " value = " 提交 " onFocus = " blur() " >
< inputname = " reset " type = " reset " class = " button " value = " 重置 " onFocus = " blur() " ></ td >
</ tr >
</ table >
</ form >
三级的联动,全是读数据库里的数据,级别:prolei--seclei--endlei

asp实现三级联动表单


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论