js倒计时
function process(url)
{
var Time=document.getElementById('Label3').innerHTML;
var i=new Array();
i=Time.split(',');
var year=i[0];
var month=i[1];
var day=i[2];
var hour=parseInt(i[3]);
var minute=parseInt(i[4]);
var second=parseInt(i[5]);
if(second==59)
{
minute=minute+1;
second=00;
}
else
{
second=second+1;
}
if(minute==60)
{
hour=hour+1;
minute=00;
}
if(hour==24)
{
hour=00;
}
var _Y =year;
var _M=month;
var _D =day;
/*
产生期号字符串
如:2008年10月16日10点35分:2008101601
*/
var _F = _Y + (_M > 9 ? ""+_M : "0"+_M) + (_D > 9 ? ""+_D : "0" + _D);
var _h = hour;
var _m = minute;
var _s = second;
var _result=0;
if ((hour == 9 && (minute+2) >= 50) ||
(hour >= 10 && hour < 21)||
(hour == 21 && (minute+2) < 50))
{if(parseInt(month)<10&&parseInt(month)>0)
{
month="0"+parseInt(month);
}
if(parseInt(day)<10&&parseInt(day)>0)
{
day="0"+parseInt(day);
}
var qi=(hour - 10) * 6+2 + Math.floor((minute+2) / 10);
if(parseInt(qi)<10&&parseInt(qi)>0)
{
qi="0"+qi;
}
_result =year+""+month+""+day+"-"+qi;
_next_seconds = 59 - second;
_next_minutes = 9 - (minute+2)% 10;
}
document.getElementById('Label3').innerHTML=year+","+month+","+day+","+hour+","+minute+","+second;//页面lable
setTimeout(process,1000);
document.getElementById("circles").innerHTML = _result;
document.all['minutes'].innerHTML = _next_minutes;
document.all['seconds'].innerHTML = _next_seconds;
document.all['Label2'].innerHTML = _result;
if(_next_minutes==0&&_next_seconds==0)
{
//alert(str);
alert('結束!');
qk();
//var str="url?id=_next_minutes";
//window.location.replace("url?id=_next_minutes");
window.location.replace(location);
}
}
function qk()
{
document.all('TextBox1').value="0";
document.all('TextBox2').value="0";
document.all('ListBox1').value="";
}