﻿var now = new Date();
function createtime(){

var grt= new Date("5/01/2010 20:00:00");

now.setTime(now.getTime()+250);
days = (grt - now) / 1000 / 60 / 60 / 24;
dnum = Math.floor(days);
hours = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;}
minutes = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes);
if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds);
if(String(snum).length ==1 ){snum = "0" + snum;}

document.getElementById("timeDate").innerHTML = "<font style='font-size:14px;'>"+"距上海世博会 还有 "+"<b><font color=#FFFF33>"+dnum+"</font></b>"+"&nbsp;天"+"</td>";
document.getElementById("times").innerHTML = "<b>&nbsp;&nbsp;<font style='font-size:14px;color:#FFFFCC;'>"+hnum + ":" + mnum + ":" + snum+"</font></b>";
}

setInterval("createtime()",250);                
