html と js 部分 复制代码代码如下: <頭> ; selectList <br>*{margin:0;padding:0;} <br>.selectList{width:200px;margin:50px auto;} <br> 请选择 请选择 请选择 请选择 请选择 请选择 <br>$(function(){ <br>$(".selectList").each(function(){ <br>var url = "area.json"; <br>var areaJson; <br>var temp_html; <br>var oProvince = $(this).find(".province"); <br>var oCity = $(this).find(".city"); <br>var oDistrict = $(this).find (".district"); <br>//初化省 <br>var province = function(){ <br>$.each(areaJson,function(i,province){ <br>temp_html ="<オプション値='" 州.p "'>" 州.p "</option>"; <br>}); <br>oProvince.html(temp_html); <br>city(); <br>}; <br>//赋值市 <br>var city = function(){ <br>temp_html = ""; <br>var n = oProvince.get(0).selectedIndex(areaJson[n] ].c,function(i,city){ <br>temp_html ="<option value='" city.ct "'>" city.ct "<br>}); 🎜>oCity.html(temp_html); <br>district(); <br>//赋值县 <br>var District = function(){ <br>temp_html = ""; m = oProvince.get(0).selectedIndex; <br>var n = oCity.get(0).selectedIndex; <br>if(typeof(areaJson[m].c[n].d) == "未定義" ){ <br>oDistrict.css("表示","なし"); <br>}else{ <br>oDistrict.css("表示","インライン"); <br>$.each(areaJson[m].c[n].d,function(i,district){ <br>temp_html ="<option value='" District.dt "'>" District.dt "</オプション><br>}); <br>oDistrict.html(temp_html); <br>}; <br>}; <br>//选择省改变市 <br>oProvince.change(function(){ <br>city(); <br>}); <br>//选择市改变县 <br>oCity.change(function(){ <br>district(); <br>}); <br>//获取jsonデータベース <br>$.getJSON(url,function(data){ <br>areaJson = data; <br>province(); <br>}); <br>}); <br>}); <br>