简单易懂的天气插件(代码分享)
效果图如下:

代码如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>天气</title>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<style type="text/css">
.xc{
width: 200px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="tp-weather-widget" class="xc"></div>
<script>
(function(T, h, i, n, k, P, a, g, e) {
g = function() {
P = h.createElement(i);
a = h.getElementsByTagName(i)[0];
P.src = k;
P.charset = "utf-8";
P.async = 1;
a.parentNode.insertBefore(P, a)
};
T["ThinkPageWeatherWidgetObject"] = n;
T[n] || (T[n] = function() {
(T[n].q = T[n].q || []).push(arguments)
});
T[n].l = +new Date();
if(T.attachEvent) {
T.attachEvent("onload", g)
} else {
T.addEventListener("load", g, false)
}
}(window, document, "script", "tpwidget", "//widget.thinkpage.cn/widget/chameleon.js"))
</script>
<script>
tpwidget("init", {
"flavor": "slim",
"location": "WX4FBXXFKE4F",
"geolocation": "disabled",
"language": "zh-chs",
"unit": "c",
"theme": "chameleon",
"container": "tp-weather-widget",
"bubble": "enabled",
"alarmType": "badge",
"color": "#F47837",
"uid": "U605DCADA4",
"hash": "78f46a1198d54dafa0cda717efa717a9"
});
tpwidget("show");
</script>
</body>
</html> 相关推荐
我欲疾风前行 2020-06-04
adonislu 2020-05-10
helen0 2020-03-09
kkpiece 2020-01-10
元元 2019-11-03
83276636 2017-04-08
smdq0 2016-07-22
80296736 2016-04-24
技术点滴 2015-08-16
米格 2015-08-02
87286336 2015-07-17
83206733 2015-07-08
regina 2015-06-10
87286336 2015-05-20
BC 2015-04-12
少莫千华 2015-04-02
combine 2014-11-26
asweee 2014-09-09