迅騰網絡>圈子>建站知識> js 國家、省份、城市連動下拉程序 ,js下拉選擇國家省份城市信息代碼

js 國家、省份、城市連動下拉程序 ,js下拉選擇國家省份城市信息代碼

熱度:15795 / 2012-11-22 / 廊坊網站建設 / 建站知識

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'MyJsp.jsp' starting page</title>
   
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 <meta http-equiv="description" content="This is my page">
 <!--
 <link rel="stylesheet" type="text/css" href="styles.css">
 -->

 

<script>
function Dsy()
{
this.Items = {};
}
Dsy.prototype.add = function(id,iArray)
{
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id)
{
if(typeof(this.Items[id]) == "undefined") return false;
return true;
}

function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
if(v)options[1].selected = true;
}
}
if(++v<s.length){ change(v); }
}
}

var dsy = new Dsy();

dsy.add("0",["中國","美國","加拿大","俄羅斯","埃及","南非","希臘","荷蘭","比利時","法國","西班牙","意大利","羅馬尼亞","瑞士","奧地利","英國","丹麥","瑞典","挪威","波蘭","秘魯","墨西哥","古巴","阿根廷","巴西","智利","哥倫比亞","委內瑞拉","馬來西亞","澳大利亞","印度尼西亞","菲律賓","新西蘭","新加坡","泰國","日本","韓國","越南","土耳其","印度","巴基斯坦","阿富汗","斯里蘭卡","緬甸","伊朗","摩洛哥","阿爾及利亞","突尼斯","利比亞","岡比亞","塞內加爾","毛里塔尼亞","圣馬力諾","幾內亞","科特迪瓦","布基拉法索","尼日爾","多哥","貝寧","毛里求斯","利比里亞","塞拉利昂","加納","尼日利亞","乍得","中非","喀麥隆","佛得角","圣多美","普林西比","赤道幾內亞","加蓬","剛果","扎伊爾","安哥拉","幾內亞比紹","阿森松","塞舌爾","蘇丹","盧旺達","埃塞俄比亞","索馬里","吉布提","肯尼亞","坦桑尼亞","烏干達","布隆迪","莫桑比克","贊比亞","馬達加斯加","留尼旺島","津巴布韋","納米比亞","馬拉維","萊索托","博茨瓦納","斯威士蘭","科摩羅","圣赫勒拿","阿魯巴島","法羅群島","格陵蘭島","匈牙利","南斯拉夫","德國","直布羅陀","葡萄牙","盧森堡","愛爾蘭","冰島","阿爾巴尼亞","馬耳他","塞浦路斯","芬蘭","保加利亞","梵蒂岡","福克蘭群島","伯利茲","危地馬拉","薩爾瓦多","洪都拉斯","尼加拉瓜","哥斯達黎加","巴拿馬","海地","玻利維亞","圭亞那","厄瓜多爾","法屬圭亞那","巴拉圭","馬提尼克","蘇里南","烏拉圭","關島","文萊","瑙魯","湯加","所羅門群島","瓦努阿圖","斐濟","科克群島","紐埃島","東薩摩亞","西薩摩亞","基里巴斯","圖瓦盧","朝鮮","柬埔寨","老撾","孟加拉國","馬爾代夫","黎巴嫩","約旦","敘利亞","伊拉克","科威特","沙特阿拉伯","阿曼","以色列","巴林","卡塔爾","不丹","蒙古","尼泊爾","威克島","中途島","夏威夷","維爾京群島","波多黎各","巴哈馬","圣盧西亞","牙買加","巴巴多斯","安圭拉島","阿拉斯加","列支敦士登","科科斯島","諾福克島","圣誕島"]);
dsy.add("0_0",["北京","上海","天津","重慶","廣東","廣西","貴州","海南","河北","河南","黑龍江","湖北","湖南","吉林","江蘇","江西","遼寧","內蒙古","寧夏","青海","山東","山西","陜西","上海","四川","天津","西藏","新疆","云南","浙江","甘肅","安徽","福建"]);

dsy.add("0_0_0",["北京"]);
dsy.add("0_0_1",["上海"]);
dsy.add("0_0_2",["天津"]);
dsy.add("0_0_3",["重慶"]);

dsy.add("0_0_4",["潮州","東莞","佛山","廣州","河源","惠州","江門","揭陽","茂名","梅州","清遠","汕頭","汕尾","韶關","深圳","陽江","云浮","湛江","肇慶","中山","珠海"]);

dsy.add("0_0_5",["百色","北海","崇左","防城港","桂林","貴港","河池","賀州","來賓","柳州","南寧","欽州","梧州","玉林"]);


dsy.add("0_0_6",["安順","畢節","貴陽","六盤水","黔東南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","銅仁","遵義"]);

dsy.add("0_0_7",["白沙黎族自治縣","保亭黎族苗族自治縣","昌江黎族自治縣","澄邁縣","定安縣","東方","海口","樂東黎族自治縣","臨高縣","陵水黎族自治縣","瓊海","瓊中黎族苗族自治縣","三亞","屯昌縣","萬寧","文昌","五指山","儋州"]);

dsy.add("0_0_8",["保定","滄州","承德","邯鄲","衡水","廊坊","秦皇島","石家莊","唐山","邢臺","張家口"]);

dsy.add("0_0_9",["安陽","鶴壁","濟源","焦作","開封","洛陽","南陽","平頂山","三門峽","商丘","新鄉","信陽","許昌","鄭州","周口","駐馬店","漯河","濮陽"]);

dsy.add("0_0_10",["大慶","大興安嶺","哈爾濱","鶴崗","黑河","雞西","佳木斯","牡丹江","七臺河","齊齊哈爾","雙鴨山","綏化","伊春"]);

dsy.add("0_0_11",["武漢","恩施土家族苗族自治州","黃岡","黃石","荊門","荊州","潛江","神農架林區","十堰","隨州","天門","鄂州","仙桃","咸寧","襄樊","孝感","宜昌"]);

dsy.add("0_0_12",["常德","長沙","郴州","衡陽","懷化","婁底","邵陽","湘潭","湘西土家族苗族自治州","益陽","永州","岳陽","張家界","株洲"]);

dsy.add("0_0_13",["白城","白山","長春","吉林","遼源","四平","松原","通化","延邊朝鮮族自治州"]);

dsy.add("0_0_14",["常州","淮安","連云港","南京","南通","蘇州","宿遷","泰州","無錫","徐州","鹽城","揚州","鎮江"]);

dsy.add("0_0_15",["撫州","贛州","吉安","景德鎮","九江","南昌","萍鄉","上饒","新余","宜春","鷹潭"]);

dsy.add("0_0_16",["鞍山","本溪","朝陽","大連","丹東","撫順","阜新","葫蘆島","錦州","遼陽","盤錦","沈陽","鐵嶺","營口"]);

dsy.add("0_0_17",["阿拉善盟","巴彥淖爾盟","包頭","赤峰","鄂爾多斯","呼和浩特","呼倫貝爾","通遼","烏海","烏蘭察布盟","錫林郭勒盟","興安盟"]);

dsy.add("0_0_18",["固原","石嘴山","吳忠","銀川"]);

dsy.add("0_0_19",["果洛藏族自治州","海北藏族自治州","海東","海南藏族自治州","海西蒙古族藏族自治州","黃南藏族自治州","西寧","玉樹藏族自治州"]);

dsy.add("0_0_20",["濱州","德州","東營","菏澤","濟南","濟寧","萊蕪","聊城","臨沂","青島","日照","泰安","威海","濰坊","煙臺","棗莊","淄博"]);


dsy.add("0_0_21",["長治","大同","晉城","晉中","臨汾","呂梁","朔州","太原","忻州","陽泉","運城"]);

dsy.add("0_0_22",["安康","寶雞","漢中","商洛","銅川","渭南","西安","咸陽","延安","榆林"]);

dsy.add("0_0_23",["上海"]);


dsy.add("0_0_24",["阿壩藏族羌族自治州","巴中","成都","達州","德陽","甘孜藏族自治州","廣安","廣元","樂山","涼山彝族自治州","眉山","綿陽","南充","內江","攀枝花","遂寧","雅安","宜賓","資陽","自貢","瀘州"]);

dsy.add("0_25",["天津"]);
dsy.add("0_25_0",["","薊縣","靜海縣","寧河縣","天津市"]);

dsy.add("0_0_26",["阿里","昌都","拉薩","林芝","那曲","日喀則","山南"]);

dsy.add("0_0_27",["阿克蘇","阿拉爾","巴音郭楞蒙古自治州","博爾塔拉蒙古自治州","昌吉回族自治州","哈密","和田","喀什","克拉瑪依","克孜勒蘇柯爾克孜自治州","石河子","圖木舒克","吐魯番","烏魯木齊","五家渠","伊犁哈薩克自治州"]);

dsy.add("0_0_28",["保山","楚雄彝族自治州","大理白族自治州","德宏傣族景頗族自治州","迪慶藏族自治州","紅河哈尼族彝族自治州","昆明","麗江","臨滄","怒江傈傈族自治州","曲靖","思茅","文山壯族苗族自治州","西雙版納傣族自治州","玉溪","昭通"]);

dsy.add("0_0_29",["杭州","湖州","嘉興","金華","麗水","寧波","紹興","臺州","溫州","舟山","衢州"]);

dsy.add("0_0_30",["白銀","定西","甘南藏族自治州","嘉峪關","金昌","酒泉","蘭州","臨夏回族自治州","隴南","平涼","慶陽","天水","武威","張掖"]);

dsy.add("0_0_31",["安慶","蚌埠","巢湖","池州","滁州","阜陽","合肥","淮北","淮南","黃山","六安","馬鞍山","宿州","銅陵","蕪湖","宣城","亳州"]);


dsy.add("0_0_32",["福州","龍巖","南平","寧德","莆田","泉州","三明","廈門","漳州"]);

var s = ["s1","s2","s3"];
var opt0 = ["國家","省份","地級市"];
function setup(n1,n2,n3)
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
change(0);
document.getElementById('s1').value=n1;
change(1);
document.getElementById('s2').value=n2;
change(2);
document.getElementById('s3').value=n3;
}
</script>

 

  </head>
 
<body onLoad="setup('中國','北京','北京')">

<select name="country" id="s1">
<option>國家</option>
</select>

<select name="prov" id="s2">
<option>省份</option>
</select>

<select name="city" id="s3">
<option>地級市</option>
</select>
  </body>
</html>

七星彩开奖 雀魂 官方网站安卓 山东德州麻将app 宝盈彩票首页 都有什么赚钱的平台 球探体育比分app 股票熊市能赚钱吗知乎 成都麻将机市场在哪里 广西快乐十分 点赞赚钱是真的假的 捕鱼游戏大厅 闲来安徽麻将免费下载 天天捕鱼2赢话费 拍照答题赚钱软件下载 大乐购游戏 好的手机赚钱 澳洲幸运10