|
省份: | |
城市: | |
區縣: |
|
省份,城市,區縣數據結構:【名稱,父類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技術:javawscript 三級菜單的實現原理,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。