jQuery 台灣郵遞區號外掛 v1.1 update

 

這次更新主要是改寫了原有的結構變得更簡潔、效能更好,並修改下列幾項:

  • 可不需先建立 HTML 表單,由程式直接產生並直接指定表單元件名稱。
  • 加入 Css 的支援

參數說明

  • countyName: 指定縣市下拉清單名稱 (String) /* 若不指定則預設名稱為 zip_county[] */
  • areaName: 指定鄉鎮市區下拉清單名稱 (String) /* 若不指定則預設名稱為 zip_area[] */
  • zipName: 指定郵遞區號輸入框名稱 (String) /* 若不指定則預設名稱為 zip_code[] */
  • countySel: 縣市預設值 (String)
  • areaSel: 鄉鎮市區預設值 (String)
  • css: ['County ClassName', 'Area ClassName', 'Zip ClassName'] (Array)

自訂元件名稱範例

  1. // Javascript
  2. $('#container').twzipcode({
  3.   countyName: 'county',
  4.   areaName: 'area',
  5.   zipName: 'zip'
  6. });
  7.  
  8. // HTML
  9. <div id="container"></div>

完整範例請參考:jQuery 台灣郵遞區號外掛

回首過往今日

標籤: , , ,

相關文章

5 則迴響 »

本篇文章迴響的訂閱源料 TrackBack URI

  1. Internet Explorer 6.0 Windows XP

    您好
    這個東西真是很讚

    不過這邊想請問一下~
    不知道您有用過表單的reset進行測試嗎?
    通常只有第一個欄位會有預設值~那第二個鄉鎮的部份常常就會停在本來選的鄉鎮了ˊˋ
    這部份不知道有沒有什麼方法可以調整呢?謝謝~~

    迴響 by flora — 2009 年 11 月 10 日 #

    Internet Explorer 6.0 Windows XP
  2. Mozilla Firefox 3.5.5 Windows XP

    我已經針對這個問題做小更新了
    請重新下載即可

    備註
    因為 reset event 無法覆寫,所以改用折衷的方式:
    縣市、鄉鎮市區下拉選單會恢復至未選狀態

    迴響 by essoduke — 2009 年 11 月 13 日 #

    Mozilla Firefox 3.5.5 Windows XP
  3. Internet Explorer 6.0 Windows XP

    謝謝~~確實可以用了~~非常感謝!
    不過跟您說一下~
    twzipcode-1.1.js
    這個檔案裡面在顯示郵遞區號的text欄位
    他的size的設定字漏了一個e喔
    因為我想說怎麼一直沒辦法改那個欄位的大小~後來才發現是少了一個e~^^

    迴響 by flora — 2009 年 12 月 10 日 #

    Internet Explorer 6.0 Windows XP
  4. Internet Explorer 8.0 Windows XP

    請問一下有辦法輸入郵遞區號反查出縣市及鄉鎮市區嗎?

    迴響 by 威爾森 — 2010 年 01 月 29 日 #

    Internet Explorer 8.0 Windows XP
  5. Mozilla Firefox 3.5.7 Windows 7

    基本上是可以的。
    不過就目前 JSON 的結構而言勢必要將所有資料都用迴圈比對一遍
    效能上可能不符合實用所需,勢必要改寫

    用資料庫配合 AJAX 應該是比較妥善的方式吧

    迴響 by essoduke — 2010 年 01 月 31 日 #

    Mozilla Firefox 3.5.7 Windows 7

發表迴響

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.