Province = new Array
City = new Array
I=0
Province[I] = '北京'
City[I] = new Array('北京')
I++
Province[I] = '上海'
City[I] = new Array('上海')
I++
Province[I] = '天津'
City[I] = new Array('天津')
I++
Province[I] = '重庆'
City[I] = new Array('重庆')
I++
Province[I] = '河北'
City[I] = new Array("请选择","石家庄","唐山","秦皇岛","邯郸","邢台","保定","张家口","承德","沧州","廊坊","衡水","其他")
I++
Province[I] = '山西'
City[I] = new Array("请选择","太原","大同","阳泉","长治","晋城","朔州","晋中","运城","忻州","临汾","吕梁")
I++
Province[I] = '内蒙古'
City[I] = new Array("请选择","呼和浩特","包头","乌海","赤峰","通辽","鄂尔多斯","呼伦贝尔","乌兰察布盟","锡林郭勒盟","巴彦淖尔盟","阿拉善盟","兴安盟")
I++
Province[I] = '辽宁'
City[I] = new Array("请选择","沈阳","大连","鞍山","抚顺","本溪","丹东","锦州","葫芦岛","营口","盘锦","阜新","辽阳","铁岭","朝阳")
I++
Province[I] = '吉林'
City[I] = new Array("请选择","长春","吉林市","四平","辽源","通化","白山","松原","白城","延边朝鲜族自治州")
I++
Province[I] = '黑龙江'
City[I] = new Array("请选择","哈尔滨","齐齐哈尔","鹤岗","双鸭山","鸡西","大庆","伊春","牡丹江","佳木斯","七台河","黑河","绥化","大兴安岭")
I++
Province[I] = '江苏'
City[I] = new Array("请选择","南京","无锡","徐州","常州","苏州","南通","连云港","淮安","盐城","扬州","镇江","泰州","宿迁")
I++
Province[I] = '浙江'
City[I] = new Array("请选择","杭州","宁波","温州","嘉兴","湖州","绍兴","金华","衢州舟山","台州","丽水")
I++
Province[I] = '安徽'
City[I] = new Array("请选择","合肥","芜湖","蚌埠","淮南","马鞍山","淮北","铜陵","安庆","黄山","滁州","阜阳","宿州","巢湖","六安","亳州","池州","宣城")
I++
Province[I] = '福建'
City[I] = new Array("请选择","福州","厦门","莆田","三明","泉州","漳州","南平","龙岩","宁德")
I++
Province[I] = '江西'
City[I] = new Array("请选择","南昌","景德镇","萍乡","新余","九江","鹰潭","赣州","吉安","宜春","抚州","上饶")
I++
Province[I] = '山东'
City[I] = new Array("请选择","济南","青岛","淄博","枣庄","东营","潍坊","烟台","威海","济宁","泰安","日照","莱芜","德州","临沂","聊城","滨州","菏泽")
I++
Province[I] = '河南'
City[I] = new Array("请选择","郑州","开封","洛阳","平顶山","焦作","鹤壁","新乡","安阳","濮阳","许昌","漯河","三门峡","南阳","商丘","信阳","周口","驻马店","济源")
I++
Province[I] = '湖北'
City[I] = new Array("请选择","武汉","黄石","襄樊","十堰","荆州","宜昌","荆门","鄂州","孝感","黄冈","咸宁","随州","仙桃","天门","潜江","神农架","恩施土家族苗族自治州")
I++
Province[I] = '湖南'
City[I] = new Array("请选择","长沙","株洲","湘潭","衡阳","邵阳","岳阳","常德","张家界","益阳","郴州","怀化","娄底","湘西土家族苗族自治州")
I++
Province[I] = '广东'
City[I] = new Array("请选择","广州","深圳","珠海","汕头","韶关","佛山","江门","湛江","茂名","肇庆","惠州","梅州","汕尾","河源","阳江","清远","东莞","中山","潮州","揭阳","云浮")
I++
Province[I] = '广西'
City[I] = new Array("请选择","南宁","柳州","桂林","梧州","北海","防城港","钦州","贵港","玉林","百色","贺州","河池","来宾","崇左")
I++
Province[I] = '海南'
City[I] = new Array("请选择","海口","三亚","五指山","琼海","儋州","文昌","万宁","东方","澄迈","定安","屯昌","临高","白沙黎族自治县昌","江黎族自治县","乐东黎族自治县","陵水黎族自治县","保亭黎族苗族自治县","琼中黎族苗族自治县")
I++
Province[I] = '四川'
City[I] = new Array("请选择","成都","自贡","攀枝花","泸州","德阳","绵阳","广元","遂宁","内江","乐山","南充","宜宾","广安","达州","眉山","雅安","巴中","资阳","阿坝藏族羌族自治州","甘孜藏族自治州","凉山彝族自治州")
I++
Province[I] = '贵州'
City[I] = new Array("请选择","贵阳","六盘水","遵义","安顺","铜仁","毕节","黔西南布依族苗族自治州","黔东南苗族侗族自治州","黔南布依族苗族自治州")
I++
Province[I] = '云南'
City[I] = new Array("请选择","昆明","曲靖","玉溪","保山","昭通","丽江","思茅","临沧","文山壮族苗族自治州","红河哈尼族彝族自治州","西双版纳傣族自治州","楚雄彝族自治州","大理白族自治州","德宏傣族景颇族自治州 ","怒江傈傈族自治州","迪庆藏族自治州")
I++
Province[I] = '西藏'
City[I] = new Array("请选择","拉萨","那曲","昌都","山南","日喀则","阿里","林芝")
I++
Province[I] = '陕西'
City[I] = new Array("请选择","西安","铜川","宝鸡","咸阳","渭南","延安","汉中","榆林","安康","商洛")
I++
Province[I] = '甘肃'
City[I] = new Array("请选择","兰州","金昌","白银","天水","嘉峪关","武威","张掖","平凉","酒泉","庆阳","定西","陇南","临夏回族自治州","甘南藏族自治州")
I++
Province[I] = '青海'
City[I] = new Array("请选择","西宁","海东","海北藏族自治州","黄南藏族自治州","海南藏族自治州","果洛藏族自治州","玉树藏族自治州","海西蒙古族藏族自治州")
I++
Province[I] = '宁夏'
City[I] = new Array("请选择","银川","石嘴山","吴忠","固原")
I++
Province[I] = '新疆'
City[I] = new Array("请选择","乌鲁木齐","克拉玛依","石河子","阿拉尔","图木舒克","五家渠","吐鲁番","哈密","和田","阿克苏","喀什","克孜勒苏柯尔克孜自治州","巴音郭楞蒙古自治州","昌吉回族自治州","博尔塔拉蒙古自治州","伊犁哈萨克自治州")
I++
Province[I] = '香港'
City[I] = new Array("香港")
I++
Province[I] = '澳门'
City[I] = new Array("澳门")
I++
Province[I] = '台湾'
City[I] = new Array("请选择","台北","高雄","基隆","台中","台南","新竹","嘉义","台北县","宜兰县","新竹县","桃园县","苗栗县","台中县","彰化县","南投县","嘉义县","云林县","台南县","高雄县","屏东县","台东县","花莲县","澎湖县")
//--要使本代码使用于不同的form,只须改变以下两个函数在FORM里的元素的name值--
function SelectLoc()
{
pbox=document.creator.Province//该行需改变provinceBox=document.formName.itemName
cbox=document.creator.citys//该行需改变cityBox=document.formName.itemName
val=pbox.value
if (val!=-1)
{
m=sel(val,Province)
clear(cbox)
for (i=0i<City[m].lengthi++){
fullup(cbox,City[m][i])
}
}
else
{
clear(cbox)
}
}
function SelectProvice()
{
SelectLoc()
var locbox = document.creator.citys//该行需改变
if(locbox.length==0) fullup(locbox, '--请选择--')
}
//--以下函数无须改变任何地方--
function clear(obj1)
{
len=obj1.length
for(i=len-1i>=0i--)
{
obj1.options[i]=null
}
}
function fullup_P(obj1,val1,val2)
{
var vn = new Option(val1,val2)
obj1.add(vn)
}
function fullup(obj1,val)
{
var vn = new Option(val,val)
obj1.add(vn)
}
function sel(val,obj1)
{
for(i=0i<obj1.lengthi++)
{
if(obj1[i]==val)
{
return i
}
}
if (i==obj1.length){
return 0
}
}
function write_option(val)
{
document.write("<option value="+val+">"+val+"</option>")
}
function selBox(obj)
{
for(I=0I<obj.lengthI++)
{
write_option(obj[I])
}
}
function selBoxi(obj)
{
for(I=0I<obj.lengthI++)
{
document.write("<option value="+(I+1)+">"+obj[I]+"</option>")
}
}
<script type="text/javascript">function pp() {
var s = document.getElementById("s2").value
var ah = new Array("安庆", "蚌埠", "巢湖", "池州", "滁州", "阜阳", "合肥", "淮北", "淮南", "黄山", "六安", "马鞍山", "宿州", "铜陵", "芜湖", "宣城", "亳州")
var js = new Array("常州", "淮安", "连云港", "南京", "南通", "苏州", "宿迁", "泰州", "无锡", "徐州", "盐城", "扬州", "镇江")
var sc = new Array("阿坝", "巴中", "成都", "达州", "德阳", "甘孜", "广安", "广元", "乐山", "凉山", "眉山", "绵阳", "南充", "内江", "攀枝花", "遂宁", "雅安", "宜宾", "资阳", "自贡", "泸州")
if (s == "0") {
for (var i = 0i <ah.lengthi++) {
document.getElementById("s3").options[i] = new Option(ah[i] + 1 + "日")
}
}
}
</script>
<div class="address">
<span>地址:</span>
<select id="s1">
<option>中国</option>
</select>
<select id="s2" onchange="javascript:pp()">
<option value="">省份、州</option>
<option value="0">安徽</option>
<option value="1">江苏</option>
<option value="2">四川</option>
</select>
<select id="s3">
<option>市、县</option>
</select>
</div>