您好,欢迎访问一九零五行业门户网

javawscript 三级菜单的实现原理_javascript技巧

省份: 请选择山东省
城市: ==请选择==威海市德州市滨州市
区县: ==请选择乡镇==威海文登荣成乳山
省份,城市,区县数据结构:【名称,父类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 {
if (subcat[i][1] == locationid)
{
document.editform.smalllocation.options[document.editform.smalllocation.length] = new option(subcat[i][0], subcat[i][2]);
}
}
}
其它类似信息

推荐信息