DOM 작업 - 소규모 연습 시간 절약

1204 단어



    
     


    
var province = document.getElementById('province'); province.onchange = function(){ var city = document.getElementById('city'); city.innerHTML = ""; var proValue = province.value; var cities = []; switch(proValue){ case " ": cities = [" "," "," "," "]; break; case " ": cities = [" "," "," "," "]; break; } var temp = document.createDocumentFragment(); // for(var i=0;i<cities.length;i++){ var opt = document.createElement("option"); opt.innerHTML=cities[i]; temp.appendChild(opt); } city.appendChild(temp); }

좋은 웹페이지 즐겨찾기