function selcity(obj, e) {
var ths = obj;
var dal = '
×
请选择省份
';
iput.show({
id: ths,
event: e,
content: dal,
width: "470"
});
$("#ccolse").click(function() {
iput.colse()
});
var tb_province = [];
var b = province;
for (var i = 0,
len = b.length; i < len; i++) {
tb_province.push('' + b[i]['name'] + '')
}
$("#_citys0").append(tb_province.join(""));
$("#_citys0 a").click(function() {
var g = getcity($(this));
$("#_citys1 a").remove();
$("#_citys1").append(g);
$("._citys1").hide();
$("._citys1:eq(1)").show();
$("#_citys0 a,#_citys1 a,#_citys2 a").removeclass("areas");
$(this).addclass("areas");
var lev = $(this).data("name");
ths.value = $(this).data("name");
if (document.getelementbyid("hcity") == null) {
var hcitys = $('', {
type: 'hidden',
name: "hcity",
"data-id": $(this).data("id"),
id: "hcity",
val: lev
});
$(ths).after(hcitys)
} else {
$("#hcity").val(lev);
$("#hcity").attr("data-id", $(this).data("id"))
}
$("#_citys1 a").click(function() {
$("#_citys1 a,#_citys2 a").removeclass("areas");
$(this).addclass("areas");
var lev = $(this).data("name");
if (document.getelementbyid("hproper") == null) {
var hcitys = $('', {
type: 'hidden',
name: "hproper",
"data-id": $(this).data("id"),
id: "hproper",
val: lev
});
$(ths).after(hcitys)
} else {
$("#hproper").attr("data-id", $(this).data("id"));
$("#hproper").val(lev)
}
var bc = $("#hcity").val();
ths.value = bc + "/" + $(this).data("name");
var ar = getarea($(this));
$("#_citys2 a").remove();
if (ar == '') iput.colse();
$("#_citys2").append(ar);
$("._citys1").hide();
$("._citys1:eq(2)").show();
$("#_citys2 a").click(function() {
$("#_citys2 a").removeclass("areas");
$(this).addclass("areas");
var lev = $(this).data("name");
if (document.getelementbyid("harea") == null) {
var hcitys = $('', {
type: 'hidden',
name: "harea",
"data-id": $(this).data("id"),
id: "harea",
val: lev
});
$(ths).after(hcitys)
} else {
$("#harea").val(lev);
$("#harea").attr("data-id", $(this).data("id"))
}
var bc = $("#hcity").val();
var bp = $("#hproper").val();
ths.value = bc + "/" + bp + "/" + $(this).data("name");
iput.colse()
})
})
})
}
function getcity(obj) {
var c = obj.data('id');
var e = province;
var f = [];
var g = '';
for (var i = 0; i < e.length; i++) {
if (e[i]['id'] == parseint(c)) {
f = e[i]['son'];
break
}
}
for (var j = 0; j < f.length; j++) {
g += '' + f[j]['name'] + ''
}
$("#_citysheng").html('请选择城市');
return g
}
function getarea(obj) {
var c = obj.data('id');
var e = province;
var f = [];
var g = '';
for (var i = 0; i < e.length; i++) {
for (var j = 0; j < e[i]['son'].length; j++) {
if (e[i]['son'][j]['id'] == parseint(c) && e[i]['son'][j]['sec']) {
f = e[i]['son'][j]['sec'];
break
}
}
}
if (f.length) {
for (var k = 0; k < f.length; k++) {
g += '' + f[k]['name'] + ''
}
}
$("#_citysheng").html('请选择区县');
return g
}