aspx页面代码
jQuery(function () { jQuery("#privince").empty(); var region = MyBooKShopWeb.JsonXMl.AjaxGet.GetRegion().value; jQuery("#privince").empty(); jQuery("select").append("<option value='0'>-请选择-</option>") for (var i = 0; i < region.length; i++) { if (i == 0) { jQuery("#privince").append("<option value='" + region[i].Province + "'>" + region[i].Province + "</option>"); } else { if (region[i].Province != null && region[i].Province != region[i - 1].Province) { jQuery("#privince").append("<option value='" + region[i].Province + "'>" + region[i].Province + "</option>"); }
}
}
jQuery("#privince").change(function () {
var pro = jQuery("#privince").val();
var city = MyBooKShopWeb.JsonXMl.AjaxGet.GetRegion(" where Province='" + pro + "'").value; jQuery("#city option:gt(0)").remove(); if (city != null && city.length != 0) { for (var i = 0; i < city.length; i++) { if (i == 0) { jQuery("#city").append("<option value='" + city[i].City + "' >" + city[i].City + "</option>"); } else { if(city[i].City != null && city[i].City != city[i - 1].City) jQuery("#city").append("<option value='" + city[i].City + "' >" + city[i].City + "</option>"); } } }
}) jQuery("#city").change(function () {
var pro = jQuery("#city").val();
var area = MyBooKShopWeb.JsonXMl.AjaxGet.GetRegion(" where City='" + pro + "'").value; jQuery("#area option:gt(0)").remove(); if (area != null && area.length != 0) { for (var i = 0; i < area.length; i++) { jQuery("#area").append("<option value='" + area[i].Area + "' >" + area[i].Area + "</option>"); } }
})
});
<select id="privince">
</select>
<select id="city">
</select>
<select id="area">
</select>
需要数据库下载地址:http://pan.baidu.com/disk/home?fr=ibaidu