<img id="MTSAT" width="200" height="215" onerror="ChangePicture()">
<SCRIPT language="javascript">
function addDate(dy,dmomth,dd,dh,dm,dadd){
var a = new Date(dy,dmomth,dd,dh,dm)
a = a.valueOf()
a = a + dadd * 1 * 60 * 60 * 1000
a = new Date(a)
return a;
}
function imgurl(dy,dm,dd,dh){
// AreaType 參數 ( 全球:s0p 東亞:s1p 台灣:s3p )
AreaType="s1p";
FileName = AreaType + "-";
FileName += dy+"-";
FileName += ((dm < 10) ? "0" : "") + dm + "-";
FileName += ((dd < 10) ? "0" : "") + dd + "-";
FileName += ((dh < 10) ? "0" : "") + dh + "-00.jpg";
return "http://www.cwb.gov.tw/V6/observe/satellite/Data/" + AreaType + "/" + FileName;
}
var HttpUrls="";
var now = new Date();
var years = now.getYear();
var months = now.getMonth()+1;
var days = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
HttpUrls=imgurl(years,months,days,hours);
MTSAT.src=HttpUrls;
function ChangePicture(){
if(hours==0){
NextNow = addDate(years,months-1,days,hours,0,-1);
years = NextNow.getYear();
months = NextNow.getMonth()+1;
days = NextNow.getDate();
hours = NextNow.getHours();
}else{
hours-=1;
}
HttpUrls=imgurl(years,months,days,hours);
MTSAT.src=HttpUrls;
}
</SCRIPT>
沒有留言:
張貼留言