Home > Web Front-end > JS Tutorial > Implementation principle of javawscript three-level menu_javascript skills

Implementation principle of javawscript three-level menu_javascript skills

WBOY
Release: 2016-05-16 18:50:52
Original
1018 people have browsed it
省份:
城市:
区县:

Province, city, district and county data structure: [name, parent ID, current ID]

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

Get the parent class ID of the next-level associated menu based on selectedIndex, Copy the code
The code is as follows:


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('==Please select==','');
document.getElementById("dlmc0") .options[0] = new Option('==Please select==','');

//alert(locationid);
var locationid=locationid;
var i;
document.editForm.smalllocation.options[0] = new Option('==Please select==','');
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]);
}
}
} <script></script><script></script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template