javawscript 三级菜单的实现原理
javawscript 三级菜单的实现原理
发布时间:2016-12-30 来源:查字典编辑
摘要:省份:请选择山东省城市:==请选择==威海市德州市滨州市区县:==请选择乡镇==威海文登荣成乳山省份,城市,区县数据结构:【名称,父类ID,...

省份: 请选择 山东省
城市: ==请选择==威海市德州市滨州市
区县:

==请选择乡镇==威海文登荣成乳山

省份,城市,区县数据结构:【名称,父类ID,当前ID】

onChange="changelocation2(document.editForm.smalllocation.options[document.editForm.smalllocation.selectedIndex].value)"

根据selectedIndex取得下一级关联菜单的父类ID,

复制代码 代码如下:

function changelocation(locationid)

{

document.editForm.smalllocation.length = 0;

// document.editForm.dlmc0.length = 0;

document.getElementById("dlmc0").length=0;

//document.editForm.dlmc0.options[0] = new Option('==请选择==','');

document.getElementById("dlmc0").options[0] = new Option('==请选择==','');

//alert(locationid);

var locationid=locationid;

var i;

document.editForm.smalllocation.options[0] = new Option('==请选择==','');

for (i=0;i < onecount; i++)

{

if (subcat[i][1] == locationid)

{

document.editForm.smalllocation.options[document.editForm.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);

}

}

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类