posts - 0,  comments - 19,  trackbacks - 0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 二级联动菜单 </TITLE>
<script language="javascript">
var jiangXi=new Array();   //江西组
jiangXi[0]=new Array('0','南昌');
jiangXi[1]=new Array('1','九江');
jiangXi[2]=new Array('2','赣州');
var liaoNing=new Array();  //辽宁组
liaoNing[0]=new Array('0','沈阳');
liaoNing[1]=new Array('1','大连');
var heBei=new Array();     //河北组
heBei[0]=new Array('0','石家庄');
heBei[1]=new Array('1','廊坊');
heBei[2]=new Array('2','保定');
heBei[3]=new Array('3','唐山');
heBei[4]=new Array('4','邢台');

function showCities(cityArray)
{
 for(i=0;i<cityArray.length;i++)
 {
 document.form1.cities.options[i]=new Option(cityArray[i][1],cityArray[i][0]);
 }
}
function updateCities()
{
var selectedProvince=document.form1.province.value;
switch(selectedProvince){
        case'0':showCities(heBei);break;
        case'1':showCities(jiangXi);break;
     case'2':showCities(liaoNing);break;
 
  }
  }
</script>

</HEAD>

<BODY>
<form name="form1" method="post" action="">
<table width= "200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<select name="province" size="1" onchange="javascript:updateCities()">

<option value="0" selected>河北</option>
<option value="1" >江西</option>
<option value="2" >辽宁</option>

</select>
<select name="cities" size="1">
<option value="0"selected>石家庄</option>
<option value="1">廊坊</option>
<option value="2">保定</option>
  <option value="3">唐山</option>
<option value="4">邢台</option>
</select>
</td>
<td> </td>
</tr>
</table>
</form>
</BODY>
</HTML>
posted on 2012-07-31 11:13 canry Tong 阅读(336) 评论(0)  编辑  收藏 所属分类: jsp

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

留言簿

文章分类

文章档案

搜索

  •  

最新评论