-
Notifications
You must be signed in to change notification settings - Fork 1
/
k3-cities.html
53 lines (44 loc) · 1.34 KB
/
k3-cities.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<title>K3 City Search by Cuteribs</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./semantic.min.css">
</head>
<body>
<div class="ui container">
<h2 class="ui dividing header">K3 外屏天气地区码搜索</h2>
<div class="ui labeled input">
<input type="text" placeholder="地区名" id="keyword">
<div class="ui label" id="province"></div>
<div class="ui label" id="city"></div>
<div class="ui label" id="county"></div>
<div class="ui label" id="code"></div>
</div>
</div>
<script src="./jquery.slim.min.js"></script>
<script src="./k3-cities.js"></script>
<script>
$(document).ready(function () {
$('#keyword').on('change', function (e) {
var keyword = $(this).val();
for (var i = 0; i < allList.length; i++) {
var provice = allList[i];
for (var j = 0; j < provice.cityList.length; j++) {
var city = provice.cityList[j];
for (var k = 0; k < city.countyList.length; k++) {
var county = city.countyList[k];
if (county && county.id && county.value.indexOf(keyword) > -1) {
$('#province').text(provice.value);
$('#city').text(city.value);
$('#county').text(county.value);
$('#code').text(county.id);
return;
}
}
}
}
});
});
</script>
</body>
</html>