展开全部
简单点的:jQuery + easyUI 实现。
/**
-- 功能描述: 加载省份
-- 参数: 无
-- 返回值: 无
**/
function loadProvince(){
$('#Province').combobox({
url: 地址,
valueField: 'Province',
textField: 'ProvinceName',
editable: true,
width: 155,
onChange: function(newValue,oldValue) {
loadCity(newValue);
}
});
}
/**
-- 功能描述: 加载创建企业的城市
-- 参数provinceKey: 省份
-- 返回值: 无
**/
function loadCity(provinceKey) {
$('#City').combobox({
url: 地址,
valueField: 'City',
textField: 'CityName',
editable: true,
width: 155,
onChange: function(newValue,oldValue) {
loadDistrict(newValue);
}
});
}
/**
-- 功能描述: 加载创建城市的区县
-- 参数cityKey: 城市
-- 返回值: 无
**/
function loadDistrict(cityKey) {
$('#District').combobox({
url: 地址,
valueField: 'District',
textField: 'DistrictName',
editable: false,
width: 155
});
}
<input id="Province" name="Province" class="easyui-combobox" />
<input id="City" name="City" class="easyui-combobox"/>
<input id="District" name="District" class="easyui-combobox"/>
数据格式如下:
[{"Province":"1","ProvinceName":"北京市"}]
[{"City":"2","CityName":"北京市"}]
[{"District":"3","DistrictName":"昌平区"},{"District":"4","DistrictName":"朝
阳区"},{"District":"5","DistrictName":"崇文区"},
{"District":"6","DistrictName":"大兴区"},{"District":"7","DistrictName":"东城
区"},{"District":"8","DistrictName":"房山区"},
{"District":"9","DistrictName":"丰台区"},{"District":"10","DistrictName":"海
淀区"},{"District":"11","DistrictName":"怀柔区"},
{"District":"12","DistrictName":"门头沟区"},
{"District":"13","DistrictName":"密云县"},{"District":"14","DistrictName":"
平谷区"},{"District":"15","DistrictName":"石景山区"},
{"District":"16","DistrictName":"顺义区"},{"District":"17","DistrictName":"
通州区"},{"District":"18","DistrictName":"西城区"},
{"District":"19","DistrictName":"宣武区"},{"District":"20","DistrictName":"
延庆县"}]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询