我有一些倒计时器的代码,它们已被修改如下:
<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>
它在前台进程上工作正常,但反之亦然。那么,我怎样才能将其转换为后台进程?提前致谢