mozda tvoj radi eto nisam probao po sto sam se snaso, ali ostalo je jos jedan problem kod moj kod, taj problem je kad vreme istice mislim minuta i sekunda dobijas alert pa onda refresh na sajtu, ali kad dobijem refresh counter minuta oped prikazuje ali sad na neki cudan nacin sa minusom minuta, meni treba kad uradi refresh na sajtu onda oped se proveruje vreme dal je isteko, ako je isteko daje se forme za popunavanje, ali nije tako u sledeci kod ili mozda gresim negde.
Code:
echo "<script type=\"text/javascript\">
// koliko minuta
var mins = $expire;
// koliko sekunda
var secs = mins * 60;
function countdown() {
timer = window.setTimeout('Decrement()',1000);
}
function Decrement() {
if (document.getElementById) {
minutes = document.getElementById(\"minutes\");
seconds = document.getElementById(\"seconds\");
// if less than a minute remaining
if (seconds < 59) {
seconds.innerHTML = secs;
} else {
minutes.innerHTML = getminutes();
seconds.innerHTML = getseconds();
}
secs--;
timer = window.setTimeout('Decrement()',1000);
if (mins == '0' && secs == '0') { secs = '0'; window.clearTimeout(timer); alert("Klick OK za sledeci post"); window.location.href = \"test.php\"; }
}
}
function getminutes() {
// minutes is seconds divided by 60, rounded down
mins = Math.floor(secs / 60);
return mins;
}
function getseconds() {
// take mins remaining (as seconds) away from total seconds remaining
return secs-Math.round(mins *60);
}
</script>";
to je ovo:
Code:
if (mins == '0' && secs == '0') { secs = '0'; window.clearTimeout(timer); alert("Klick OK za sledeci post"); window.location.href = \"test.php\"; }