以下代码假如是注册页面时的连动菜单的选择省份与城市,在编辑页面时怎么做?
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 无标题文档 </title>
<script language= "javascript ">
function ChangeProvince(province,city){
var provinces=new Array();
provinces=[ '选择省份 ', '北京 ', '上海 ', '其它 '];
document.myform.province.length=provinces.length;
for(var i=0;i <provinces.length;i++){
document.myform.province.options[i].text=provinces[i];
document.myform.province.options[i].value=provinces[i];
if(provinces[i]==province){
document.myform.province.options[i].selected=true;
}
}
ChangeCity(province,city);
}
function ChangeCity(province,city){
var citys=new Array();
switch(province){
case '选择省份 ':
citys=[ '选择城市 '];
break;
case '北京 ':
citys=[ '东城 ', '西城 ', '崇文 ', '宣武 ', '朝阳 ', '海淀 ', '丰台 ', '石景山 ', '门头沟 ', '房山 ', '通州 ', '顺义 ', '昌平 ', '大兴 ', '平谷 ', '海淀 ', '怀柔 ', '密云 ', '其它 '];
break;
case '上海 ':
citys=[ '黄浦区 ', '卢湾区 ', '徐汇区 ', '长宁区 ', '静安区 ', '普陀区 ', '闸北区 ', '虹口区 ', '杨浦区 ', '宝山区 ', '闵行区 ', '嘉定区 ', '浦东新区 ', '松江区 ', '金山区 ', '青浦区区 ', '南汇区 ', '奉贤区 ', '崇明县 ', '其它 '];
break;
}
document.myform.city.length=citys.length;
for(var i=0;i <citys.length;i++){
document.myform.city.options[i].text=citys[i];
document.myform.city.options[i].value=citys[i];
if(citys[i]==city){
document.myform.city.options[i].selected=true;
}
}
}
//-->
</SCRIPT>
</head>
<body bgcolor= "ffffff " topmargin= "10 " marginwidth= "0 " onLoad= "ChangeProvince( '选择省份 ', '选择城市 ');document.myform.city.options.selectedIndex=0 ">
<form name= "myform " method= "post " action= "# " onSubmit= "return validform(this) ">
所在省市:
<table>
<TD bgColor=#dff0ff height=35 width=349> <select size= "1 " name= "province " onChange= "ChangeCity(this.value) " style= "BACKGROUND-COLOR: #99CCFF; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000 "> </select> <select size= "1 " name= "city " style= "BACKGROUND-COLOR: #99CCFF; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000 "> </select>
</table>
</form>
</body>
</html>
------解决方案--------------------
我已经把答案发到你邮箱请注意查收