省市級連、動的に省の下の市街地をcheckboxで並べます


         ,       input   ,      
<script type="text/JAVAscript">
<!--
var values = new Array();
values[0] = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
values[1] = new Array("a", "b", "c", "d", "e", "f", "g", "h");
function setMultiple(val) {
	var checkBox;
	var checkboxDiv=document.getElementById("checkbox");
	//checkboxDiv.style.display="none";
	//alert(values[val].length);
	input = checkboxDiv.getElementsByTagName("input");
	for(var i = 0; i < input.length; i++){
		//input[i].parentNode.removeChild(input[i]);
		checkboxDiv.removeChild(input[i]);
	}

	
    for (var i = 0; i < values[val].length; i++) {
        //alert(i);
        //alert(checkboxDiv.getElementsByTagName('input').length);
       
        checkBox = document.createElement("input"); 
 		checkBox.type = "checkbox";
 		checkBox.name = "name";
        
	    checkboxDiv.appendChild(checkBox);
	    checkboxDiv.appendChild(document.createTextNode(values[val][i]));
	    
		//checkboxDiv.style.display="block";
    }    
}
-->
</script>

 
<body>
<div id="div_parent">
<select onchange="setMultiple(this.value);"><option value=0>--00--</option><option value=1>--11--</option></select>
</div>
<div id="checkbox"></div>
</body>