Сообщение от blits
|
я протестировал
|
Чего ты там тестировал...
У тебя там фарш полный идет.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<script src='http://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
</script>
</head>
<body>
<div class="timer"><div class="minutes" id="min1">50</div><div class="seconds" id="sec1">NaN</div></div>
<script type="text/javascript">
function startTimer() {
var seconds = 1430;
var minutes = Math.floor(seconds / 60);
var min1 = minutes * 60;
var sec = seconds - min1;
var textt = '00' + minutes + ':' + sec;
var my_timer = document.getElementById("my_timer");
var arr = textt.split(":");
alert(arr)
var h = arr[0];
var m = arr[1];
var s = arr[2];
alert(s)
if (s == 0) {
if (m == 0) {
if (h == 0) {
alertifty.alert("Время вышло");
window.location.reload();
return;
}
h--;
m = 60;
if (h < 10) h = "0" + h;
}
m--;
if (m < 10) m = "0" + m;
s = 59;
} else {
s--;
};
alert(s)
if (s < 10) s = "0" + s;
alert(m+' - '+s)
document.getElementById("min1").innerHTML = m;
document.getElementById("sec1").innerHTML = s;
setTimeout(startTimer, 1000);
}
startTimer();
</script>
</body>
</html>