利用jquery 獲取json數(shù)據(jù)實(shí)現(xiàn)三級聯(lián)動(dòng) 省市區(qū)

1哲泊、index.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>jQuery省市區(qū)三級聯(lián)動(dòng)選擇代碼</title>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script src="js/Popt.js"></script>
    <script src="js/cityJson.js"></script>
    <script src="js/citySet.js"></script>
    <style type="text/css">
        * { -ms-word-wrap: break-word; word-wrap: break-word; }
        html { -webkit-text-size-adjust: none; text-size-adjust: none; }
        html, body {height:100%;width:100%; }
        html, body, h1, h2, h3, h4, h5, h6, div, ul, ol, li, dl, dt, dd, iframe, textarea, input, button, p, strong, b, i, a, span, del, pre, table, tr, th, td, form, fieldset, .pr, .pc { margin: 0; padding: 0; word-wrap: break-word; font-family: verdana,Microsoft YaHei,Tahoma,sans-serif; *font-family: Microsoft YaHei,verdana,Tahoma,sans-serif; }
        body, ul, ol, li, dl, dd, p, h1, h2, h3, h4, h5, h6, form, fieldset, .pr, .pc, em, del { font-style: normal; font-size: 100%; }
        ul, ol, dl { list-style: none; }
        ._citys { width: 450px; display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
        ._citys span { color: #56b4f8; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #56b4f8; cursor: pointer; }
        ._citys0 { width: 100%; height: 34px; display: inline-block; border-bottom: 2px solid #56b4f8; padding: 0; margin: 0; }
        ._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
        .citySel { background-color: #56b4f8; color: #fff !important; }
        ._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
        ._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 13px; overflow: hidden; }
        ._citys1 a:hover { color: #fff; background-color: #56b4f8; }
        .AreaS { background-color: #56b4f8 !important; color: #fff !important; }
    </style>
</head>
<body>
<div style="width:420px;margin:40px auto;">
    <input type="text" id="city" />
</div>
<script type="text/javascript">
    $("#city").click(function (e) {
        SelCity(this,e);
    });
</script>
<script>

</script>
</body>
</html>

2剩蟀、cityJson.js 。切威。育特。。

3先朦、citySet.js 缰冤。。喳魏。棉浸。

4、Popt.js 刺彩。迷郑。。创倔。

效果如圖:


三級聯(lián)動(dòng).jpg

源代碼 :https://github.com/AMONTOP/jQuery-Regions.git
幫到你的話 點(diǎn)個(gè)贊噢嗡害!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市畦攘,隨后出現(xiàn)的幾起案子霸妹,更是在濱河造成了極大的恐慌,老刑警劉巖知押,帶你破解...
    沈念sama閱讀 216,692評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件叹螟,死亡現(xiàn)場離奇詭異,居然都是意外死亡台盯,警方通過查閱死者的電腦和手機(jī)首妖,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,482評論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來爷恳,“玉大人有缆,你說我怎么就攤上這事。” “怎么了棚壁?”我有些...
    開封第一講書人閱讀 162,995評論 0 353
  • 文/不壞的土叔 我叫張陵杯矩,是天一觀的道長。 經(jīng)常有香客問我袖外,道長史隆,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,223評論 1 292
  • 正文 為了忘掉前任曼验,我火速辦了婚禮泌射,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘鬓照。我一直安慰自己熔酷,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,245評論 6 388
  • 文/花漫 我一把揭開白布豺裆。 她就那樣靜靜地躺著拒秘,像睡著了一般。 火紅的嫁衣襯著肌膚如雪臭猜。 梳的紋絲不亂的頭發(fā)上躺酒,一...
    開封第一講書人閱讀 51,208評論 1 299
  • 那天,我揣著相機(jī)與錄音蔑歌,去河邊找鬼羹应。 笑死,一個(gè)胖子當(dāng)著我的面吹牛次屠,可吹牛的內(nèi)容都是我干的量愧。 我是一名探鬼主播,決...
    沈念sama閱讀 40,091評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼帅矗,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了煞烫?” 一聲冷哼從身側(cè)響起浑此,我...
    開封第一講書人閱讀 38,929評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎滞详,沒想到半個(gè)月后凛俱,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,346評論 1 311
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡料饥,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,570評論 2 333
  • 正文 我和宋清朗相戀三年蒲犬,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片岸啡。...
    茶點(diǎn)故事閱讀 39,739評論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡原叮,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情奋隶,我是刑警寧澤擂送,帶...
    沈念sama閱讀 35,437評論 5 344
  • 正文 年R本政府宣布,位于F島的核電站唯欣,受9級特大地震影響嘹吨,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜境氢,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,037評論 3 326
  • 文/蒙蒙 一蟀拷、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧萍聊,春花似錦问芬、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,677評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至牛隅,卻和暖如春炕柔,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背媒佣。 一陣腳步聲響...
    開封第一講書人閱讀 32,833評論 1 269
  • 我被黑心中介騙來泰國打工匕累, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人默伍。 一個(gè)月前我還...
    沈念sama閱讀 47,760評論 2 369
  • 正文 我出身青樓欢嘿,卻偏偏與公主長得像,于是被迫代替她去往敵國和親也糊。 傳聞我的和親對象是個(gè)殘疾皇子炼蹦,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,647評論 2 354

推薦閱讀更多精彩內(nèi)容