Witam, mam taki problem, mam funkcję "counter", ktora odlicza mi czas, jest tylko problem, gdy użyje funkcji 2x, to nie dziala.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Przekierowanie</title>
<script type="text/javascript">
var secs = 0; //**** liczba sekund do odliczenia
var element = 'czas'; //**** atrybut "id" elementu wyświetlającego wynik
var T = null;
temp = secs;
if(secs > 0){
//**** ten kawałek kodu "rozbija" sekundy na inne jednostki
result
= Math
.floor(temp
/ 86400) + ' dni '; temp %= 86400;
result
+= Math
.floor(temp
/ 3600) + ' godzin '; temp %= 3600;
result
+= Math
.floor(temp
/ 60) + ' minut '; temp %= 60;
result += temp + ' sekund';
document.getElementById(element).innerHTML = result; //**** wypisanie stanu zegara
secs--;
}else{
document.location="http://google.pl"
clearInterval(T);
}
}
function counter(days, hours, minutes, seconds){
secs = days*86400 + hours*3600 + minutes*60 + seconds;
T = window.setInterval("count()", 1000);
//count();
}
</script>
</head>
<body>
<div id="czas"></div>
<script type="text/javascript">counter(0,0,0,8);</script>
<script type="text/javascript">counter(0,0,0,16);</script>
</body>
</html>