JavaScript倒计时后台进程
我有一些倒计时计时器的代码,已修改如下:JavaScript倒计时后台进程,javascript,Javascript,我有一些倒计时计时器的代码,已修改如下: <script language="JavaScript" type="text/JavaScript"> var Timer; var TotalSeconds; var timer_interval; function CreateTimer(TimerID,Time) { Timer = document.getElementById(TimerID); window.TotalSeconds = getCookie('
<script language="JavaScript" type="text/JavaScript">
var Timer;
var TotalSeconds;
var timer_interval;
function CreateTimer(TimerID,Time) {
Timer = document.getElementById(TimerID);
window.TotalSeconds = getCookie('Times');
if(!window.TotalSeconds){
window.TotalSeconds = Time;
}
timer_interval=window.setTimeout(Ticker(),1000);
window.clearTimeout(timer_interval);
deleteCookie('Times');
UpdateTimer();
window.setTimeout(Ticker(), 1000);
}
function UpdateTimer() {
var Seconds = window.TotalSeconds;
var Hours = Math.floor(Seconds / 3600);
Seconds -= Hours * (3600);
var Minutes = Math.floor(Seconds / 60);
Seconds -= Minutes * (60);
var TimeStr = LeadingZero(Hours) + ":" + LeadingZero(Minutes) + ":"+LeadingZero(Seconds);
Timer.innerHTML = " Your Time Slot Temporary Blocked Will Last For : "+ TimeStr;
}
function Ticker() {
if (window.TotalSeconds <= 0)
{
location.href="admin.jsp?action=zerosecond";
window.clearTimeout(time_interval);
deleteCookie('Time');
}
window.TotalSeconds -= 1;
setCookie('Times', window.TotalSeconds, 1);
UpdateTimer();
window.setTimeout(Ticker(), 1000);
}
function LeadingZero(Time) {
return (Time < 10) ? "0" + Time : + Time;
}
function setCookie(name,value,days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
}
else {
expires = "";
}
document.cookie = name+"="+value+expires+"; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
}
function deleteCookie(name) {
setCookie(name,"",-1);
}
</script>
无功定时器;
var总秒数;
无功定时器间隔;
函数CreateTimer(TimerID,Time){
Timer=document.getElementById(TimerID);
window.TotalSeconds=getCookie('Times');
如果(!window.TotalSeconds){
window.TotalSeconds=时间;
}
timer_interval=window.setTimeout(Ticker(),1000);
窗口清除超时(计时器间隔);
删除Cookie(“时间”);
UpdateTimer();
setTimeout(Ticker(),1000);
}
函数UpdateTimer(){
var Seconds=window.TotalSeconds;
var小时=数学地板(秒/3600);
秒-=小时*(3600);
var分钟=数学地板(秒/60);
秒-=分钟*(60);
var TimeStr=超前零(小时)+“:”+超前零(分钟)+“:”+超前零(秒);
Timer.innerHTML=“您的临时阻塞时间将持续:”+TimeStr;
}
函数代码(){
如果(window.TotalSeconds),javascript中没有“前台”或“后台”进程。请解释什么是前台和后台请参见