<div class="codetitle"> <span><a style="CURSOR: pointer" data="78911" class="copybut" id="copybut78911" onclick="doCopy('code78911')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code78911"> <br><!DOCTYPE HTML PUBLIC "-//W3C/ /DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <br><html> <br><head> <br><제목> ;json< /title> <br><script type="text/javascript"> <br><!-- <BR>var list=[{"name":"중국", <BR>"값 ":" 86", <BR>"지방":[{"name":"후베이", <BR>"값":"430000", <BR>"도시":[{"name":"우한" ,"값":"wh"}, <BR>{"이름":"Huanggang","값":"hg"}, <BR>{"이름":"Xiangyang","값":"xy" }]} , <BR>{"이름":"허베이", <BR>"값":"100000", <BR>"도시":[{"이름":"한단","값":"hd "}, <BR>{"이름":"바오딩","값":"bd"}, <BR>{"이름":"스자좡","값":"sjz"}]}, <br> <br> {"이름":"후난", <BR>"값":"440000", <BR>"도시":[{"이름":"창사","값":"cs"}, <BR>{ "이름":"주저우","값":"zz"}, <BR>{"이름":"헝양","값":"hy"}]}]}, <BR>{" 이름": "미국", <BR>"값":"22", <BR>"지방":[{"이름":"아칸소", <BR>"값":"990000", <BR> "도시": [{"이름":"뉴욕","값":"뉴욕"}, <BR>{"이름":"워싱턴","값":"hsd"}, <BR>{" 이름":"보스턴","값":"bsd"}]}, <br><br>{"이름":"아하하", <BR>"값":"980000", <BR>"도시" :[{" 이름":"AA","값":"ahd"}, <BR>{"이름":"BB","값":"abd"}, <BR>{"이름":" CC"," value":"asjz"}]}] <br><br>}]; <br><br>function init(){ <BR>var _country=document.getElementById("country"); <BR>for( var e in list){ <BR>var opt_1=new Option(list[e].name,list[e].value) <BR>_country.add(opt_1) <BR>} <BR><br><br><br>function toProvince(){ <br>var _country=document.getElementById("country") <BR>var _province=document.getElementById("province"); 🎜>var _city =document.getElementById("city"); <BR>var v_country=_country.value <BR><BR>_province.options.length=1; 🎜><br>for(var e in list){ <br>if(list[e].value==v_country){ <BR>for( var p in list[e].province){ <br>var opt_2 =new Option( list[e].province[p].name,list[e].province[p].value) <br>_province.add(opt_2) <BR><BR>} <BR>break ; <BR> } <br>} <br>} <BR><BR><BR>function toCity(){ <BR>var _country=document.getElementById("country") <br>var _province=document. getElementById("지방"); <br>var _city=document.getElementById("도시"); <BR><BR>var v_country=_country.value; <BR><BR>//_province .options.length=1; <br>_city.options.length=1; <br><BR><br>for(목록의 변수){ <br>if(list[e].value ==v_country) { <BR>for( var p in list[e].province){ <br>//alert(list[e].province[p].value) <br>if(list[e] .province[p ].value==v_province){ <BR>// Alert(list[e].province[p].value) <BR>for(var cc in list[e].province[p]. 도시){ <BR>var opt_3=new Option(list[e].province[p].city[cc].name,list[e].province[p].city[cc].value) <BR> _city.add( opt_3); <BR><BR>return; <BR>} <BR><BR><BR>} <br>break; <br><BR>//--> <br></head> <br><br><body onload="init();";> ><select id="country" onchange="toProvince();"> <br><option value="-1">--국가를 선택하세요---</option> </select> <br><select id="province" onchange="toCity();"> <br><option value="-1">--도를 선택하세요---< ;/option> <br></select> <br><select id="city"> <br><option value="-1">--도시를 선택하세요. /옵션> <br> </select> <br><br></body> <br><br> </div>