VAR Url=esca
PE("http://m.weather.com.cn/data/101210701.html");
var COOKIE_info = "COOKIE_info";
var date = new Date();
var Hours=24-date.getHours()-1;
var Mins=60-date.getMinutes()-1;
var Secs=60-date.getSeconds();
date.setTime(date.getTime() + (1 * Hours * 60 * 60 * 1000) + (1 * 1 * Mins * 60 * 1000) + (1 * 1 * 1 * Secs * 1000));
var RD_cookie_info= $.cookie(COOKIE_info);
$(function(){
if(RD_cookie_info
==null)
{
Getdata(Url);
}
else{
$("
#weather").html(RD_cookie_info);
}
})
function Getdata(Url)
{
$.ajax({
type:"GET",
cache: "false",
url: "AjaxGet.asp",
data:"Url="+Url,
dataType: "html",
error: function(){$("#weather").html("读取失败
...请刷新重试!");},
success: function(json){
var t = '('+json+')';
var result = eval(t);
var Getinfo="";
Getinfo+=result.weatherinfo.date_y+"&
amp;nbsp;";//
年月日
Getinfo+=result.weatherinfo.date+" ";//农历年月日
Getinfo+=result.weatherinfo.week+" ";//星期几
Getinfo+="<
br />";//换行
Getinfo+=result.weatherinfo.c
ITy;//获取城市名称
Getinfo+=" <
img src=\"http://m.weather.com.cn/img/c"+result.weatherinfo.img1+".gif\"/> "//天气图片1
Getinfo+="<img src=\"http://m.weather.com.cn/img/c"+result.weatherinfo.img2+".gif\"/> ";//天气图片2
Getinfo+=result.weatherinfo.weather1+" ";//天气情况
Getinfo+=result.weatherinfo.temp1;//
温度 $.cookie(COOKIE_info,Getinfo, { path: '/', e
xpires: date });
$("#weather").html(Getinfo);
}
});
}
<div id="weather" style="font-
Size:12px;"></div>