寫一個關聯選擇省份城市的selector

采用json数据啦

/**
* @author {sasumi}
* @version 1.0
* @since 2009-01-07
*
* @param string proivnce_sel 省份所在的select
* @param string city_sel 城市所在的select
* @param int init_pid 初始化省份ID
* @param int init_cid 初始化城市ID
*/
function pc_selector(province_sel, city_sel, init_pid, init_cid){
var $ = function(tag){
return typeof(tag) == 'string' ? document.getElementById(tag) : tag;
}
 
var province_sel = $(province_sel);
var province_start_len = province_sel.getElementsByTagName('OPTION').length;
 
var city_sel = $(city_sel);
var city_start_len = city_sel.getElementsByTagName('OPTION').length;

Read the rest of this entry »