js三级联动

2021-06-17 20:04

阅读:500

标签:石家庄   str   []   ddn   联动   orm   dna   sel   func   

$scope.province = [
{ "proID": 1, "proName": "河北省" },
{ "proID": 2, "proName": "湖南省" },
{ "proID": 3, "proName": "河南省" }];
$scope.city = [
{ "cityID": 1, "cityName": "石家庄", "proID": 1 },
{ "cityID": 2, "cityName": "长沙市", "proID": 2 },
{ "cityID": 3, "cityName": "郑州市", "proID": 3},
{ "cityID": 4, "cityName": "南阳市", "proID": 3 },
{ "cityID": 5, "cityName": "驻马店市", "proID": 3}];
$scope.district = [
{ "Id": 1, "DisName": "东城区", "cityID": 1},
{ "Id": 2, "DisName": "西城区", "cityID": 1 },
{ "Id": 3, "DisName": "崇文区", "cityID": 1 },
{ "Id": 4, "DisName": "宣武区", "cityID": 1 },
{ "Id": 5, "DisName": "和平区", "cityID": 2 },
{ "Id": 6, "DisName": "河西区", "cityID": 2 },
{ "Id": 7, "DisName": "河东区", "cityID": 2 },
{ "Id": 8, "DisName": "红桥区", "cityID": 2 },
{ "Id": 9, "DisName": "惠济区", "cityID": 3 },
{ "Id": 10, "DisName": "金水区", "cityID": 3 },
{ "Id": 11, "DisName": "二七区", "cityID": 3},
{ "Id": 12, "DisName": " 高新区", "cityID": 3 },
{ "Id": 13, "DisName": "卧龙区", "cityID": 4 },
{ "Id": 14, "DisName": "唐河县", "cityID": 4 },
{ "Id": 15, "DisName": "西峡县", "cityID": 4 }];
$scope.addName = [];
$scope.addName2 = [];
$scope.selPro = function () {
$scope.selCity = [];
for (var i = 0; i if ($scope.city[i].proID == $scope.form.province.proID) {
$scope.selCity.push($scope.city[i]);
}
}
}
$scope.selCit = function () {
$scope.selDistrict = [];
for (var i = 0; i if ($scope.district[i].cityID == $scope.form.city.cityID) {
$scope.selDistrict.push($scope.district[i]);
}
}
}

js三级联动

标签:石家庄   str   []   ddn   联动   orm   dna   sel   func   

原文地址:http://www.cnblogs.com/0280-hnn/p/7264646.html

上一篇:HTML第四课+(CSS基础)

下一篇:HTML 初识


评论


亲,登录后才可以留言!