[CODE]<script language="JavaScript">
function bb(num,num1){
city = new Array();
city[1]= new Array("唐山市","1","1");
city[2]= new Array("石家庄","2","1");
city[3]= new Array("营口市","3","2");
city[4]= new Array("沈阳市","4","2");
if(num1==1){
mr_id=1;
mr_text="唐山市";}
else{
mr_id=0;
mr_text="请选择市";}
//把数组的值用数据库读出
document.form1.s1.length = 0;
document.form1.s2.length = 0;
document.form1.s1.options[0]= new Option(mr_text,mr_id);
document.form1.s2.options[0]= new Option("请选择县","0");
j=1;
for(i=1;i<=4;i++)
{ if(city[i][2]==num)
{document.form1.s1.options[document.form1.s1.length]= new Option(city[i][0],city[i][1]);}
j++}
}
function cc(num,num1){
city = new Array();
city[1]= new Array("唐山路北区","1","1");
city[2]= new Array("唐山古冶区","2","1");
city[3]= new Array("石家庄正定","3","2");
city[4]= new Array("石家庄新集","4","2");
city[5]= new Array("营口站前区","5","3");
city[6]= new Array("营口西市区","6","3");
city[7]= new Array("沈阳市区","7","4");
city[8]= new Array("沈阳三好街","8","4");
if(num1==1){
mr_id=1;
mr_text="唐山路北区";}
else{
mr_id=0;
mr_text="请选择县";}
//把数组的值用数据库读出
document.form1.s2.length = 0;
document.form1.s2.options[0]= new Option(mr_text,mr_id);
j=1;
for(i=1;i<=8;i++)
{ if(city[i][2]==num)
{document.form1.s2.options[document.form1.s2.length]= new Option(city[i][0],city[i][1]);}
j++}
}
</script>
<body onload="bb(1,1);cc(1,1)">
<form name="form1" method="post" action="">
<!--form1.ss的值用数据库读出-->
<select name="ss" onChange="bb(document.form1.ss.options[document.form1.ss.selectedIndex].value,0)">
<option value="0">请选择省</option>
<option value="1" selected>河北省</option>
<option value="2">辽宁省</option>
</select>
<select name="s1" onChange="cc(document.form1.s1.options[document.form1.s1.selectedIndex].value,0)">
</select>
<select name="s2" id="s2">
</select>
</form>
</body>
[/CODE]
[此贴子已经被作者于2005-8-25 16:16:21编辑过]