js当地天气调用

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
    body{
        color: red;
        background: #fff;
    }
    </style>
</head>

<body>
    <div class="weather">
        <iframe class="iframe" name="weather_iframe" scrolling="no" frameborder="0" allowtransparency="true" src="//i.tianqi.com/index.php?c=code&id=12&color=%23FFFFFF&icon=1&num=1&site=12"></iframe>
    </div>
    <div id="tp-weather-widget"></div>
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <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.seniverse.com/widget/chameleon.js"))
    
    tpwidget("init", {       
        "flavor": "slim",
               "location": "WX4FBXXFKE4F",
               "geolocation": "enabled",
               "language": "zh-chs",
               "unit": "c",
               "theme": "chameleon",
               "container": "tp-weather-widget",
               "bubble": "enabled",
               "alarmType": "badge",
               "color": "#F47837",
               "uid": "UC6AD9E048",
               "hash": "76465b415261736ddd08da3f7f9b24d0"   
    });   
    tpwidget("show");
    </script>
</body>

</html>

 

posted @ 2019-01-18 15:17  abcByme  阅读(933)  评论(0编辑  收藏  举报