欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Jquery獲取當(dāng)前城市的天氣信息

 更新時(shí)間:2016年08月05日 08:49:14   作者:taogege2016  
這篇文章主要為大家詳細(xì)介紹了Jquery獲取當(dāng)前城市的天氣信息,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Jquery獲取當(dāng)前城市的天氣信息代碼,供大家參考,具體內(nèi)容如下

HTML代碼:
<div id="weather"></div>
Jquery代碼:

function findWeather() {
  var cityUrl = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js';
  $.getScript(cityUrl, function(script, textStatus, jqXHR) {
    var citytq = remote_ip_info.city ;// 獲取城市
    var url = "http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&city=" + citytq + "&day=0&dfc=3";
    $.ajax({
      url : url,
      dataType : "script",
      scriptCharset : "gbk",
      success : function(data) {
        var _w = window.SWther.w[citytq][0];
        var _f= _w.f1+"_0.png";
        if(new Date().getHours() > 17){
           _f= _w.f2+"_1.png";        
        }
        var img = "<img width='16px' height='16px' src='http://i2.sinaimg.cn/dy/main/weather/weatherplugin/wthIco/20_20/" +_f
        + "' />";
        var tq = citytq + " " + img + " " + _w.s1 + " " + _w.t1 + "℃~" + _w.t2 + "℃ " + _w.d1 + _w.p1 + "級(jí)";
         
        $('#weather').html(tq);
      }
    });
  });
}
 
findWeather();

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論