两级联动菜单 与 多级联动菜单

两级联动菜单

----------------------------------------------------------------------------------------------


<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN">
<HTML>
<HEAD>
<TITLE>NewDocument</TITLE>
<METANAME="Generator"CONTENT="EditPlus">
<METANAME="Author"CONTENT="">
<METANAME="Keywords"CONTENT="">
<METANAME="Description"CONTENT="">
<scriptlanguage="JavaScript"type="text/javascript">
<!--
varprovince_ar=newArray("","学历文凭|旅游管理,工商企业管理,文秘,金融,国际贸易,会计,英语,计算机应用,法律,艺术设计","成人高教|工商企业管理,国际经济与贸易,外贸英语,计算机应用与管理,艺术设计","高教自考|饭店管理,工商企业管理,中英合作商务管理,保险,国际贸易,英语,电子商务,计算机及应用,法律,广告");

functionshow_province()
{
varpro_tmp=document.all.province;
for(m=pro_tmp.options.length-1;m>0;m--)
pro_tmp.options[m]=null;

for(i=0;i<province_ar.length;i++)
{
if(province_ar[i]!="")
{
tmp=province_ar[i].split("|");
pro_tmp.options[i]=newOption(tmp[0],tmp[0]);
}
}
}
functionshow_city(sc)
{
vartemp=document.all.city;
for(m=temp.options.length-1;m>0;m--)
temp.options[m]=null;

if(province_ar[sc]!="")
{
tmp=province_ar[sc].split("|");
tmp=tmp[1];
tmp=tmp.split(",");
for(i=0;i<tmp.length;i++)
{
temp.options[i]=newOption(tmp[i],tmp[i]);
}
}
}
setTimeout("show_province();",20);//第一个搜索中省份城市对应
-->
</script>
</HEAD>

<BODY>
<FORMname="testform"id="testform">
<selectid=province
οnchange=show_city(this.options.selectedIndex)>
<OPTIONvalue=""selected>请选择类别</option>
</select>
<selectid=city>
<OPTIONvalue=""selected>请选择专业</OPTION>
</select>
</FORM>
</BODY>
</HTML>

----------------------------------------------------------------------------------------------

多级联动菜单

----------------------------------------------------------------------------------------------


<BODY>
<SELECTNAME="s1"><option>需要JavaScript才能正确显示</SELECT>
<SELECTNAME="s2"></SELECT>
<SELECTNAME="s3"></SELECT>
<SELECTNAME="s4"></SELECT>
<SCRIPTLANGUAGE="JavaScript">
<!--
//选择框的名字
selector=["s1","s2","s3","s4"];
//选择项:"名字","值",子选择
menu=[
"地球","1",
[
"中国","86",
[
"北京","BJ",
[
"--","1",null
],
"四川","SC",
[
"成都","28",null,
"乐山","",null,
"攀枝花","",null,
"自贡","",null,
"德阳","",null,
"绵阳","",null
]
],
"米国","1",
[
"加利福尼亚","CA",
[
"旧金山","1",null,
"洛杉矶","2",null
],
"华盛顿","WA",
[
"西雅图","seattle",null
]
]
],
"火星","2",
[
"大峡谷","86",
[
"小山丘","BJ",
[
"A地区","28",null,
"B地区","",null,
"C地区","",null
]
]
]
];

functionwizz(level)
{
if(level==0)
a=menu;
else
{
str="menu";
for(i=0;i<level;i++)
str+="["+(document.all[selector[i]].selectedIndex*3+2)+"]";
a=eval(str);
}
if(a==null)return;
s=document.all[selector[level]];
i=s.length;
while(i>0)s.options[--i]=null;
while(i<Math.floor(a.length/3))
s.options[i]=Option(a[i*3],a[i++*3+1]);
s.οnchange=Function("wizz("+(level+1)+")");
wizz(level+1);
}
wizz(0);
//-->
</SCRIPT>
</BODY>
</HTML>

----------------------------------------------------------------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值