倒计时代码
2013-08-14 23:59:38 来源: 浏览: 次
导读:<span id="times">< span>
<SCRIPT LANGUAGE="JavaScript">
function _fresh()
{
var endtime=new Date("2012 12 22,23:00:00");
var
<span id="times"></span>
<SCRIPT LANGUAGE="JavaScript">
function _fresh()
{
var endtime=new Date("2012/12/22,23:00:00");
var nowtime = new Date();
var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
__d=parseInt(leftsecond/3600/24);
__h=parseInt((leftsecond/3600)%24);
__m=parseInt((leftsecond/60)%60);
__s=parseInt(leftsecond%60);
document.getElementById("times").innerHTML="<font face=黑体 size=4><b>"+__h+"</font></b>"+"小时 "+"<font face=黑体 size=4><b>"+__m+"</font></b>"+"分 "+"<font face=黑体 size=4><b>"+__s+"</font></b>"+"秒";
if(leftsecond<=0){
document.getElementById("times").innerHTML="抢购已结束";
clearInterval(sh);
}
}
_fresh()
var sh;
sh=setInterval(_fresh,1000);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function _fresh()
{
var endtime=new Date("2012/12/22,23:00:00");
var nowtime = new Date();
var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
__d=parseInt(leftsecond/3600/24);
__h=parseInt((leftsecond/3600)%24);
__m=parseInt((leftsecond/60)%60);
__s=parseInt(leftsecond%60);
document.getElementById("times").innerHTML="<font face=黑体 size=4><b>"+__h+"</font></b>"+"小时 "+"<font face=黑体 size=4><b>"+__m+"</font></b>"+"分 "+"<font face=黑体 size=4><b>"+__s+"</font></b>"+"秒";
if(leftsecond<=0){
document.getElementById("times").innerHTML="抢购已结束";
clearInterval(sh);
}
}
_fresh()
var sh;
sh=setInterval(_fresh,1000);
</SCRIPT>