var param_pref_cd = ""; var param_area_cd = ""; function init(pref_cd,area_cd){ //パラメータがあればそれをグローバル変数に保存しておく param_pref_cd = pref_cd; param_area_cd = area_cd; document.ok_search.area_cd.options.length = 1 ; //document.getElementById('area_cd').options.length = 1; //document.getElementById('citycd').options.length = 1; //地域パラメータがあればそれを選択 if(param_pref_cd != null) { for(i=0; i<=document.ok_search.pref_cd.length; i++) { if (document.ok_search.pref_cd.options[i].value == param_pref_cd) { param_pref_cd = null; document.ok_search.pref_cd.options[i].selected = true; loadJS(); break; } } } else { document.ok_search.pref_cd.options[0].selected = true; document.ok_search.area_cd.options[0].selected = true; } } function Area(name, value) { this.name = name ; this.value = value ; } function selectArea() { document.ok_search.area_cd.options.length = 1; document.ok_search.area_cd.options.length = areas.length + 1; for( i = 0; i < areas.length; i++ ){ document.ok_search.area_cd.options[i+1] = new Option( areas[i].name, areas[i].value ); } //国、エリアパラメータがあればそれを選択 if(param_area_cd != null) { for(i=0; i<=document.ok_search.area_cd.length; i++) { if (document.ok_search.area_cd.options[i].value == param_area_cd) { param_area_cd = null; document.ok_search.area_cd.options[i].selected = true; //selectCountry(); break; } } }else{ document.ok_search.area_cd.options[0].selected = true; } } //動的に地域別jsファイルを読み込む function loadJS(){ if(document.ok_search.pref_cd.selectedIndex > 0) { dynamicLoad(document.ok_search.pref_cd.options[document.ok_search.pref_cd.selectedIndex].value); }else{ document.ok_search.area_cd.options.length = 1; document.ok_search.area_cd.options[0].selected = true; } }