<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script src="citys.js" type="text/javascript" charset="utf-8"></script>
<script src="machine.js" type="text/javascript" charset="utf-8"></script>
<select id="province"></select>
<select id="city"></select>
<select id="area"></select>
<script type="text/javascript">
let province=$("#province")
let city=$("#city")
let area=$("#area")
citys.forEach(item=>{
let option=document.createElement("option")
option.innerHTML=item.provinceName
$("#province").appendChild(option)
})
function updateCity(index){
var index=index||0;
city.innerHTML=""
citys[index].mallCityList.forEach(item=>{
let option=document.createElement("option")
option.innerHTML=item.cityName
$("#city").appendChild(option)
})
}
updateCity(0)
function updateArea(provinceIndex,areaIndex){
var index=index||0;
area.innerHTML=""
citys[provinceIndex].mallCityList[areaIndex].mallAreaList.forEach(item=>{
let option=document.createElement("option")
option.innerHTML=item.areaName
$("#area").appendChild(option)
})
}
updateArea(0,0)
province.onchange=function(){
updateCity(this.selectedIndex)
updateArea(this.selectedIndex,city.selectedIndex)
}
city.onchange=function(){
updateArea(province.selectedIndex,this.selectedIndex)
}
</script>
</body>
</html>