javascript动态控制select表单内容
<script language="JavaScript">
<!–
var P1=new Array(
new Array("110000","aaa1"),
new Array("120000","bbb1"),
new Array("130000","ccc1"),
new Array("140000","ddd1"),
new Array("150000","eee1")
);
var c1=new Array(
new Array("110000","aaa2"),
new Array("120000","bbb2"),
new Array("130000","ccc2"),
new Array("140000","ddd2"),
new Array("150000","eee2"),
new Array("210000","fff2"),
new Array("220000","ggg2")
);
function a1(selProvince)
{
document.getElementById(selProvince).options[0]=new Option("请选择","000000");
for(i=0;i<P1.length;i++)
{
document.getElementById(selProvince).options[i+1]=new Option(P1[i][1],P1[i][0]);
}
document.getElementById(selProvince).options.selected=true;
document.getElementById(selProvince).length=i+1;
}
function a2(selProvince)
{
document.getElementById(selProvince).options[0]=new Option("请选择","000000");
for(i=0;i<c1.length;i++)
{
document.getElementById(selProvince).options[i+1]=new Option(c1[i][1],c1[i][0]);
}
document.getElementById(selProvince).options.selected=true;
document.getElementById(selProvince).length=i+1;
}
–>
</script>
<BODY>
<form name="form1" method="post" method="post">
<input type="radio" value="1" name="a" onclick="a1('b')">第一个 <input type="radio" value="0" name="a" onclick="a2('b')">第二个
<select name="b" id="b"></select>
</form>
</BODY>