[CODE]
<script language="JavaScript">
function bb(num){
city = new Array();
city[1]= new Array("唐山市","1","1");
city[2]= new Array("石家庄","2","1");
city[3]= new Array("廊坊市","3","1");
city[4]= new Array("秦皇岛","4","1");
city[5]= new Array("保定市","5","1");
city[6]= new Array("营口市","6","2");
city[7]= new Array("沈阳市","7","2");
city[8]= new Array("大连市","8","2");
city[9]= new Array("鞍山市","9","2");
city[10]= new Array("盘锦市","10","2");
//把数组的值用数据库读出
document.form1.s1.length = 0;
j=1;
for(i=1;i<=10;i++)//数组有几项i<=几
{ if(city[i][2]==num)
{document.form1.s1.options[document.form1.s1.length]= new Option(city[i][0],city[i][0]);}
j++}
}
function cc(tex){
document.form1.tt.value=tex;
}
</script>
<body onLoad="bb(1)">
<form name="form1" method="post" action="">
<!--form1.ss的值用数据库读出-->
<input type="text" name="tt" value="唐山市"><br>
<select name="ss" onChange="bb(document.form1.ss.options[document.form1.ss.selectedIndex].value)">
<option value="1">河北省</option>
<option value="2">辽宁省</option>
</select><br>
<select name="s1" size="5" onChange="cc(document.form1.s1.options[document.form1.s1.selectedIndex].value)">
</select>
</form>
</body>
[/CODE]
[此贴子已经被作者于2005-9-6 9:21:41编辑过]