zoukankan      html  css  js  c++  java
  • 天气获取

     $.get("http://wthrcdn.etouch.cn/WeatherApi", { citykey: cityCode }, function (d) {
                //创建文档对象
                var parser = new DOMParser();
                var xmlDoc = parser.parseFromString(d, "text/xml");
                var cityList = xmlDoc.getElementsByTagName('city');
                var city = $(cityList[0]).text();
                var weatherList = xmlDoc.getElementsByTagName('weather');
                var $weather = $(weatherList[0]);
                var date = $weather.children("date").text();//时间
                var high = $weather.find("high").text();//最高气温
                var low = $weather.find("low").text();//最低气温
                var dayType = $weather.find("day type").text();//白天天气
                var nightType = $weather.find("night type").text();//晚上天气
                var html = city + "<label style='10px;'></label>"
                    + "白天:" + dayType + ",晚上:" + nightType
                    + "<label style='10px;'></label>"
                    + low
                    + "<label style='10px;'></label>"
                    + high;
                var aWeather = document.getElementById("aWeather");
                aWeather.innerHTML = html;
                aWeather.setAttribute("href", "http://www.weather.com.cn/weathern/" + cityCode + ".shtml");
            });

    接口调用:

    http://wthrcdn.etouch.cn/WeatherApi?city=昆明

    或者

    http://wthrcdn.etouch.cn/WeatherApi?citykey=citycode

  • 相关阅读:
    startx
    BIOS above 4g setting
    How to download file from google drive
    凤凰财经
    SOTA state-of-the-art model
    update gpu drivers
    /opt/nvidia/deepstream/deepstream/sources/libs/nvdsinfer_customparser/nvdsinfer_custombboxparser.cpp
    retinanet keras
    fp16 fp32 int8
    tf.gather with tf.Session() as sess:
  • 原文地址:https://www.cnblogs.com/tangchun/p/7839449.html
Copyright © 2011-2022 走看看