JS——天气预报表格

Posted 燕林夕

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JS——天气预报表格相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<table border="1"cellpadding="5" width="100%">
<tr><th>日期</th><th>日出</th><th>高温</th><th>低温</th><th>日落</th><th>空气质量</th><th>风向</th><th>风力</th><th>类型</th><th>小提示</th></tr>
<script type="text/javascript">

var air=[{
"date":"18日星期一",
"sunrise":"07:47",
"high":"高温 8.0℃",
"low":"低温 5.0℃",
"sunset":"18:23",
"aqi":65.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"阴",
"notice":"灰蒙蒙的天空就像模糊了的眼睛"
},
{
"date":"19日星期二",
"sunrise":"07:47",
"high":"高温 9.0℃",
"low":"低温 2.0℃",
"sunset":"18:23",
"aqi":69.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"多云",
"notice":"今日多云,骑上单车去看看世界吧",
},
{
"date":"20日星期三",
"sunrise":"07:48",
"high":"高温 11.0℃",
"low":"低温 1.0℃",
"sunset":"18:24",
"aqi":57.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"晴",
"notice":"lovely sunshine,尽情享受阳光的温暖吧",
},
{
"date":"21日星期四",
"sunrise":"07:49",
"high":"高温 14.0℃",
"low":"低温 1.0℃",
"sunset":"18:24",
"aqi":58.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"晴",
"notice":"天气干燥,请适当增加室内湿度",
},
{
"date":"22日星期五",
"sunrise":"07:49",
"high":"高温 14.0℃",
"low":"低温 3.0℃",
"sunset":"18:25",
"aqi":51.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"晴",
"notice":"晴空万里,去沐浴阳光吧",
},
{ "date":"23日星期六",
"sunrise":"07:50",
"high":"高温 16.0℃",
"low":"低温 4.0℃",
"sunset":"18:25",
"aqi":56.0,
"fx":"无持续风向",
"fl":"<3级",
"type":"多云",
"notice":"悠悠的云里有淡淡的诗",
}
];
for(var i=0;i<air.length;i++){
document.write("<tr>");
for(var j in air[i]){
document.write("<td>"+air[i][j]+"</td>")
console.log(air[i][j])
}
document.write("</tr>")
}
</script>
</table>
</body>
</html>































































































以上是关于JS——天气预报表格的主要内容,如果未能解决你的问题,请参考以下文章

检测天气用户是不是在反应js和javascript中滚动div的底部

如何用js获取景区天气预报呢

如何用js调用天气预报代码 最新

js动态显示天气预报

用JS怎样显示自动获取城市和天气预报

将查询正确格式化为Google表格/天气公式