jquery.cityselect.js基於jQuery+JSON的省市或自訂聯動效果

來源:互聯網
上載者:User

標籤:

一、外掛程式介紹

最早做省市聯動的時候都特別麻煩,後來在helloweba的一篇文章中看到這個外掛程式,很不錯的,後來就一直用了。

省市區聯動下拉效果在WEB中應用非常廣泛,尤其在一些會員資訊系統、電商網站最為常見。開發人員一般使用Ajax實現無重新整理下拉聯動。本文將講述,利用jQuery外掛程式,通過讀取JSON資料,實現無重新整理動態下拉省市二(三)級聯動效果。

 

二、外掛程式作者及網址

暫無(請作者看到後聯絡我[email protected],好標上你的大名)
官方網址:無
官方DEMO:無
最新版本:日期2012-7-18

三:外掛程式參數
參數名 預設值 字元類型 使用頻率 釋義說明
url js/city.min.js string 常用 省市資料josn檔案路徑
prov null string 常用 預設省份
city null string 常用 預設城市
dist null boolean 常用 預設地區(縣)
nodata null string 常用 無資料狀態
required true boolean 常用 必選項

下載參數文檔 http://www.ijquery.cn/demo/cityselect/cityselect.js參數說明.xls

四:外掛程式案例

1、本站案例
a>demo1  http://www.ijquery.cn/demo/cityselect

下載  http://www.ijquery.cn/demo/cityselect/cityselect.zip

五:最簡使用教程

樣本:http://www.ijquery.cn/demo/cityselect/simple.html

1、HTML代碼

<div id="city"> <select class="prov"></select> <select class="city" disabled="disabled"></select> <select class="dist" disabled="disabled"></select> </div>

2、JS和CSS代碼 ,請注意這裡預設需要把城市資料庫 city.min.js 放到 jquery.cityselect.js 所在的資料庫中,千萬不要丟失!

<script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/jquery.cityselect.js"></script><script type="text/javascript">$(function(){$("#city").citySelect({nodata:"none",required:false}); });</script>

為方便可以直接引用絕對位址

這裡的city.mini.js的絕對位址在 http://www.ijquery.cn/js/cityselect/city.min.js

 

<script type="text/javascript" src="http://www.ijquery.cn/js/jquery.js"></script><script type="text/javascript" src="http://www.ijquery.cn/js/cityselect/jquery.cityselect.js"></script><script type="text/javascript">$(function(){$("#city").citySelect({nodata:"none",required:false}); });</script>

 

繼續瀏覽有關 Jquery外掛程式聯動外掛程式表單外掛程式進階頁面 的文章

jquery.cityselect.js基於jQuery+JSON的省市或自訂聯動效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.