<div class="timer1">
<h3>Мы работаем для вас:</h3>
<table>
<tbody><tr class="time">
<td class="years" style="width: 60px;">4</td>
<td class="days" style="width: 60px;">--</td>
<td class="hours">23</td>
<td style="vertical-align: middle;">:</td>
<td class="mins">23</td>
<td style="vertical-align: middle;">:</td>
<td class="secs">15</td>
</tr>
<tr class="signature">
<td class="ye" style="width: 60px;">года</td>
<td class="dt" style="width: 60px;">дней</td>
<td class="ht">час</td>
<td style="vertical-align: middle;"> </td>
<td class="mt">минут</td>
<td style="vertical-align: middle;"> </td>
<td class="st">секунд</td>
</tr>
</tbody></table>
</div>
<script language="JavaScript" type="text/javascript"
function timer_start (node, dateObj)
{
var node = $(node);
if (node.length == 1)
{
var days = node.find('.days');
var hours = node.find('.hours');
var mins = node.find('.mins');
var secs = node.find('.secs');
var day = new Number(days.text());
var hour = new Number(hours.text());
var min = new Number(mins.text());
var sec = new Number(secs.text());
sec = (sec >= 10 ? sec : '0'+sec);
min = (min >= 10 ? min : '0'+min);
hour = (hour >= 10 ? hour : '0'+hour);
setTimeout(function()
{
var t = true;
if (sec == 0) sec = 60;
if (sec > 1)
{
sec --;
sec = (sec >= 10 ? sec : '0'+sec);
secs.html(sec);
} else {
secs.html(60);
sec = 60;
if (min > 0)
{
min--;
min = (min >= 10 ? min : '0'+min);
mins.html(min);
} else {
mins.html(59); min = 59;
secs.html(60); sec = 60;
if (hour > 0)
{
hour--;
hour = (hour >= 10 ? hour : '0'+hour);
hours.html(hour);
} else {
mins.html(59); min = 59;
secs.html(60); sec = 60;
if (day > 0)
{
day--;
day = (day >= 10 ? day : day);
days.html(day);
} else {
mins.html('00');
secs.html('00');
days.html('0');
t = false;
}
}
}
}
if (t === true) timer_start (node, dateObj);
}, 1000);
}
}
function timer_start2 (node, dateObj)
{
var node = $(node);
if (node.length == 1)
{
var days = node.find('.days');
var hours = node.find('.hours');
var mins = node.find('.mins');
var secs = node.find('.secs');
var day = new Number(days.text());
var hour = new Number(hours.text());
var min = new Number(mins.text());
var sec = new Number(secs.text());
sec = (sec >= 10 ? sec : '0'+sec);
min = (min >= 10 ? min : '0'+min);
hour = (hour >= 10 ? hour : '0'+hour);
setTimeout(function()
{
var t = true;
if (sec < 59)
{
sec ++;
sec = (sec >= 10 ? sec : '0'+sec);
secs.html(sec);
} else { // sec = 60
secs.html('00');
sec = 0;
if (min < 59)
{
min++;
min = (min >= 10 ? min : '0'+min);
mins.html(min);
} else {
mins.html('00'); min = 0;
secs.html('00'); sec = 0;
if (hour < 23)
{
hour++;
hour = (hour >= 10 ? hour : '0'+hour);
hours.html(hour);
} else {
mins.html('00'); min = 0;
secs.html('00'); sec = 0;
hours.html('00'); hour = 0;
if (day >= 0)
{
day++;
day = (day >= 10 ? day : day);
days.html(day);
} else {
mins.html('00');
secs.html('00');
days.html('0');
t = false;
}
}
}
}
if (t === true) timer_start2 (node, dateObj);
}, 1000);
}
}
</script>
<script>timer_start2('.timer1');</script>
<script language="JavaScript" type="text/javascript" src="https://www.sam73.ru/timer.js"></script><script>timer_start2('.timer1');</script>
скобку то я поставила.
И таймер заработал, но.. начал считать секунды, минуты в положенное время меняются, сколько дней не отображается, и при обновлении страницы все сначала. И в хтмл редакторе на сайте выделяет первую строку красным, но в консоли ошибок больше нет