javascript自动补全(数据用js数组存放)
航空公司城市对自动提示补全JS
//****************************************************************************
// Author Kevin.Liu
// Version 2.0.0
// date 2009-02-15
// MSN:Liu_585@126.com
// QQ:48049106
//****************************************************************************
//机场根据城市查找三字码
function getThreeWordByCitysFlight(cityName) {
var threeWord = "";
for (var i = 0, len = citysFlight.length; i < len; i++) {
if (cityName == citysFlight[i][1]) {
threeWord = citysFlight[i][0];
break;
}
}
return threeWord;
}
//初始化常用城市
var commoncitys = new Array();
commoncitys[0] = new Array('PEK', '北京首都', 'BEIJING', 'BJ');
commoncitys[1] = new Array('SHA', '上海虹桥', 'SHANGHAI', 'SH');
commoncitys[2] = new Array('SZX', '深圳', 'SHENZHEN', 'SZ');
commoncitys[3] = new Array('CAN', '广州', 'GUANGZHOU', 'GZ');
commoncitys[4] = new Array('HGH', '杭州', 'HANGZHOU', 'HZ');
commoncitys[5] = new Array('CSX', '长沙', 'CHANGSHA', 'CS');
commoncitys[6] = new Array('CKG', '重庆', 'CHONGQING', 'CQ');
commoncitys[7] = new Array('XIY', '西安', 'XIAN', 'XA');
commoncitys[8] = new Array('WUH', '武汉', 'WUHAN', 'WH');
commoncitys[9] = new Array('NKG', '南京', 'NANJING', 'NJ');
commoncitys[10] = new Array('TAO', '青岛', 'QINGDAO', 'QD');
commoncitys[11] = new Array('SYX', '三亚', 'SANYA', 'SY');
commoncitys[12] = new Array('XMN', '厦门', 'XIAMEN', 'XM');
commoncitys[13] = new Array('KMG', '昆明', 'KUNMING', 'KM');
commoncitys[14] = new Array('CTU', '成都', 'CHENGDU', 'CD');
//初始化各个城市
var citys = new Array();
citys[0] = new Array('SHA', '上海虹桥', 'SHANGHAI', 'SH'); citys[1] = new Array('HYN', '黄岩', 'HUANGYAN', 'HY'); citys[2] = new Array('HGH', '杭州', 'HANGZHOU', 'HZ'); citys[3] = new Array('YIW', '义乌', 'YIWU', 'YW'); citys[4] = new Array('JUZ', '衢州', 'JUZHOU', 'QZ'); citys[5] = new Array('HSN', '舟山', 'ZHOUSHAN', 'ZS'); citys[6] = new Array('WNZ', '温州', 'WENZHOU', 'WZ'); citys[7] = new Array('NGB', '宁波', 'NINGBO', 'NB'); citys[8] = new Array('LNJ', '临沧', 'LINCANG', 'LC'); citys[9] = new Array('ZAT', '昭通', 'ZHAOTONG', 'ZT'); citys[10] = new Array('SYM', '思茅', 'SIMAO', 'SM'); citys[11] = new Array('LUM', '芒市', 'MANSHI', 'MS'); citys[12] = new Array('BSD', '保山', 'BAOSHAN', 'BS'); citys[13] = new Array('KMG', '昆明', 'KUNMING', 'KM'); citys[14] = new Array('JHG', '西双版纳', 'XISHUANGBANNA', 'XSBN'); citys[15] = new Array('DLU', '大理', 'DALI', 'DL'); citys[16] = new Array('DIG', '迪庆', 'DIQING', 'DQ'); citys[17] = new Array('LJG', '丽江', 'LIJIANG', 'LJ'); citys[18] = new Array('LXA', '拉萨', 'LHASA', 'LS'); citys[19] = new Array('TCG', '塔城', 'TACHENG', 'TC'); citys[20] = new Array('IQM', '且末', 'QIEMO', 'QM'); citys[21] = new Array('KCA', '库车', 'KUCHE', 'KC'); citys[22] = new Array('HTN', '和田', 'HETAN', 'HT'); citys[23] = new Array('HMI', '哈密', 'HAMI', 'HM'); citys[24] = new Array('FYN', '富蕴', 'FUYUN', 'FY'); citys[25] = new Array('AKU', '阿克苏', 'AGESU', 'AKS'); citys[26] = new Array('URC', '乌鲁木齐', 'WULUMUQI', 'WLMQ'); citys[27] = new Array('KHG', '喀什', 'KASHI', 'KS'); citys[28] = new Array('KRL', '库尔勒', 'KUERLE', 'KEL'); citys[29] = new Array('KRY', '克拉玛依', 'KELAMAYI', 'KLMY'); citys[30] = new Array('AAT', '阿勒泰', 'ALETAI', 'ALT'); citys[31] = new Array('YIN', '伊宁', 'YINING', 'YN'); citys[32] = new Array('TSN', '天津', 'TIANJIN', 'TJ'); citys[33] = new Array('AKA', '安康', 'ANKANG', 'AK'); citys[34] = new Array('ENY', '延安', 'YANAN', 'YA'); citys[35] = new Array('HZG', '汉中', 'HANZHONG', 'HZ'); citys[36] = new Array('XIY', '西安', 'XIAN', 'XA'); citys[37] = new Array('UYN', '榆林', 'YULIN',