sel_city = { tcitys: new Array(2), provinceobj: function() { return document.getElementById('province'); }, tcityobj: function() { return document.getElementById('city'); }, tcityary: function(strprovince, strcity) { this.province = strprovince; this.tcity = strcity; }, tinit: function(strprovince, strcity) { this.tcitys[0]= new this.tcityary('亚洲$:$3', '|北京$:$14|上海$:$15|香港$:$206|新加坡$:$210|曼谷$:$211|吉隆坡$:$212|东京$:$213|台湾$:$214'); this.tcitys[1]= new this.tcityary('北美洲$:$100', '|纽约$:$149|旧金山$:$150|洛杉矶$:$151|华盛顿$:$152|拉斯维加斯$:$153'); with(this.provinceobj()) { tselIndex = 0; innerHTML = null; tlength = this.tcitys.length; for (ti = 0; ti < tlength; ti ++) { provinceAry = this.tcitys[ti].province.split('$:$'); if (provinceAry[1] == strprovince) tselIndex = ti; options[ti] = new Option(provinceAry[0], provinceAry[1]); } options.selectedIndex = tselIndex; } with(this.tcityobj()) { innerHTML = null; tcitylist = (this.tcitys[tselIndex].tcity).split('|'); tlength = tcitylist.length; for (ti = 0; ti < tlength; ti ++) { tcitylistAry = tcitylist[ti].split('$:$'); if (tcitylistAry[1] == strcity) tselIndex = ti; options[ti] = new Option(tcitylistAry[0], tcitylistAry[1]); } options.selectedIndex = tselIndex; } }, tloadcity: function(strprovince) { for (ti = 0; ti < this.tcitys.length; ti ++) { provinceAry = this.tcitys[ti].province.split('$:$'); if (strprovince == provinceAry[1]) { with(this.tcityobj()) { innerHTML = null; tcitylist = (this.tcitys[ti].tcity).split('|'); tlength = tcitylist.length; for (tk = 0; tk < tlength; tk ++) { tcitylistAry = tcitylist[tk].split('$:$'); options[tk] = new Option(tcitylistAry[0], tcitylistAry[1]); } } break; } } }, tselect: function() { with(this.provinceobj()) {tselectedprovince = options[selectedIndex].value;} this.tloadcity(tselectedprovince); } }