Mam taki kod na odliczanie czasu zaczyna się od 8 godzin i 19 sekund tylko po odświerzeniu on znowu się zeruje i od nowa liczy czy da się zrobić gdy strona nie jest włączona np.jak w ogame żeby czas dalej leciał i po odświerzeniu się nie resetował?
var time = "0";
var Marker = "false";
timera = new Array();
timerb = new Array();
countdown();
function setDivText(c1, text) {
document.getElementById(c1).innerHTML=text;
}
function addTimer(seconds, divName, url) {
// 3 Sekunden dazu
timera[timera.length] = seconds;
timerb[timerb.length] = divName;
var url = url;
}
function countdown() {
//alert(location);
for (i=0; i<timera.length;i++) {
if (timera[i] > 0) {
if (--timera[i] > 0) {
lSeconds = timera[i]%60; // bisserl komplizierte Formatierung
lMinutes = Math.floor(timera[i] / 60);
lHours = Math.floor(lMinutes / 60);
lMinutes%=60;
lHours= ((lHours<10)?"0":"") + (lHours);
lMinutes= ((lMinutes<10)?"0":"") + (lMinutes);
lSeconds =((lSeconds<10)?"0":"") + (lSeconds);
if(lMinutes>=59 && lSeconds>=0){setDivText(timerb[i], "<span><b>( " + lHours + ":" + lMinutes
+ ":" + lSeconds +" )</b></span>");}
else{setDivText(timerb[i], "
<span><b>( " + lHours + ":" + lMinutes + ":" + lSeconds +"
}
else {
//setDivText(timerb[i], "
<span class='rot'>bereit
</span>");
timera[i] += time; // als 'wieder frei' markieren
window.location.href = location;
}
}
else {
//setDivText(timerb[i], "
<span class='rot'>bereit
</span>");
timera[i] += time; // als 'wieder frei' markieren
window.location.href = location;
}
}
setTimeout("countdown()", 1000);
}
function confirm_delete_cat(text,loc) {
if (confirm(text)) {
/* sehende Seite */
location.href = loc;
}
}
function neuesFenster(URL,Name,Stats) {
window.open(URL,Name,Stats)
}
function CheckboxenAktivieren(field) {
if(Marker=="false") {
if(field.length){
for(i=0; i<field.length; i++) {
field[i].checked = true;
}
}
else{
field.checked = true;
}
Marker = "true";
return "Alle De-Markieren";
}
else {
if(field.length){
for(i=0; i<field.length; i++) {
field[i].checked = false;
}
}
else{
field.checked = false;
}
Marker = "false";
return "Alle Markieren";
}
}
<script language="JavaScript"> function gamepay_item(url) {
var new_win =
window.open(url,'Gamepay','resizable=yes,scrollbars=yes,menubar=no,toolbar=no,status=yes,width=820,height=8
00,top=0,left=0');
new_win.focus();
}