-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
49 lines (41 loc) · 1.12 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IFE JavaScript Task 01</title>
</head>
<body>
<h3>污染城市列表</h3>
<ul id="aqi-list">
<!--
<li>第一名:福州(样例),10</li>
<li>第二名:福州(样例),10</li> -->
</ul>
<script type="text/javascript">
var aqiData = [
["北京", 90],
["上海", 50],
["福州", 10],
["广州", 50],
["成都", 90],
["西安", 100]
];
(function () {
/*
在注释下方编写代码
遍历读取aqiData中各个城市的数据
将空气质量指数大于60的城市显示到aqi-list的列表中
*/
var len = aqiData.length;
var aqiList = document.getElementById('aqi-list');
for(var i=0;i<len;i++){
if(aqiData[i][1]>60){
var li = document.createElement('li');
li.innerText = aqiData[i][0] + ' , ' + aqiData[i][1];
aqiList.appendChild(li);
}
}
})();
</script>
</body>
</html>