比如 出生地 省份:云南 城市:思茅
在编辑个人页面时,显示城市仅 一个下拉菜单项目 思茅
本人修改了一下:source/script_city.js
1.新增 function getcitysbyprov_(province){
case "安徽" :
var cityOptions = new Array(
"合肥(*)", "合肥",
"宣城", "宣城");
break;
case "北京" :
...
return cityOptions;
}
2.
function setcity(provinceid, cityid) {
var province = document.getElementById(provinceid).value;
cityOptions = getcitysbyprov_(province);
var cityObject = document.getElementById(cityid);
cityObject.options.length = 0;
cityObject.options[0] = new Option("选择城市", "");
for(var i = 0; i < cityOptions.length/2; i++) {
cityObject.options[i+1] = new Option(cityOptions[i*2],cityOptions[i*2+1]);
}
}
3.
function showcity(cityid, city, province) {
var html = " <select name=\"" + cityid + "\" id=\"" + cityid + "\">";
html = html + "<option value=\"\">选择城市</option>";
if(province != "") {
cityOptions = getcitysbyprov_(province);
var stemp;
for(var i = 0; i < cityOptions.length/2; i++) {
if(cityOptions[i*2+1] == city)
stemp = " selected=\"selected\"";
else
stemp = "";
html = html + "<option value=\"" + cityOptions[i*2+1] + "\"" + stemp + ">" + cityOptions[i*2] + "</option>";
}
}
html = html + "</select>";
document.write(html);
}
4. template\default\cp_profile.htm
126 行 showcity('birthcity', '$space[birthcity]','$space[birthprovince]');
137行 showcity('residecity', '$space[residecity]','$space[resideprovince]'); |