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>varareaJson; <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 <br>$.each(areaJson[n ].c,function(i,city){ <br>temp_html ="<option value='" city.ct "'>" city.ct "</option>" <br>}); 🎜>oCity.html(temp_html); <br>district(); <br>}; <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("display","none"); <br>}else{ <br>oDistrict.css("display","inline"); <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>