简单易懂的天气插件(代码分享)

编程学习 2021-07-04 19:20www.dzhlxh.cn编程入门
本文主要分享了天气插件的示例代码。具有很好的参考价值,狼蚁网站SEO优化跟着长沙网络推广一起来看下吧

效果图如下:

代码如下所示:

<!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>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持狼蚁SEO!

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板