Strict Standards: Resource ID#26 used as offset, casting to integer (26) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401

Strict Standards: Resource ID#28 used as offset, casting to integer (28) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401

Strict Standards: Resource ID#29 used as offset, casting to integer (29) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401
ТвойWeb :: Версия для печати :: Исправить
ТвойWeb » WebMaster класс » JavaScript » Исправить

Страниц (1): [1]
 

1. lolisant - 31 Марта, 2009 - 19:06:40 - перейти к сообщению
Дорый вечер,есть скрипт:


<style>
.countdown b {
font: 32px Verdana;
font-weight:bold;
color:red;
}
#CD_secs,#CD_days {
font: 20px Verdana;
font-weight:bold;
color:red;
}
#CD_day{
font: 12px Verdana;
color:red;
}
</style>
<div style="position:absolute;top:135px;text-align:center;width:100%;">
<div style="padding-left:320px;">
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 align=center>
<TR ALIGN=center CLASS=countdown>
<TD WIDTH=25%><B ID=CD_days>0</B></TD>
<TD ROWSPAN=2 WIDTH=75%><B ID=CD_hours>00</B><B ID=to>:</B><B ID=CD_mins>00</B><B ID=CD_secs>00</B>
</TD>
</TR>
<TR ALIGN=center>
<TD WIDTH=25% ID=CD_day></TD>
</TR>
</TABLE></div></div>
<script>
function st(num){
if (num > 2000) return '0' + (num - 2000);
else if (num < 10) return '0' + num;
else return num;
}
function cd_timer(){
LastSec--;
if (LastSec < 0) {
clearInterval(timer_id);
}
else{
var secs = LastSec % 60;
var temp = Math.floor(LastSec / 60);
var mins = temp % 60;
temp = Math.floor(temp / 60);
var hours = temp % 24;
var days = Math.floor(temp / 24);
document.getElementById('CD_secs'Подмигивание.innerHTML = st(secs);
document.getElementById('CD_mins'Подмигивание.innerHTML = st(mins);
document.getElementById('CD_hours'Подмигивание.innerHTML = st(hours);
document.getElementById('CD_days'Подмигивание.innerHTML = days;
document.getElementById('CD_day'Подмигивание.innerHTML = /[234]$/.test(days.toString()) ? 'дня' : (days == 1 ? 'день' : 'дней'Подмигивание;
}
}
var now = new Date();
var LastSec = Math.round((1237586399000 - now.getTime()) / 1000) + 1;
cd_timer();
var timer_id = setInterval(cd_timer, 1000);
</script>



Скажите как убрать в переди ноль,и чтобы отчет назад начинался от 15 минут.Спасибо
2. Furax - 31 Марта, 2009 - 23:29:36 - перейти к сообщению
Например, вот так:
CODE:
<style>
.countdown b {
font: 32px Verdana;
font-weight:bold;
color:red;
}
#CD_secs,#CD_days {
font: 20px Verdana;
font-weight:bold;
color:red;
}
#CD_day{
font: 12px Verdana;
color:red;
}
</style>
<div style="position:absolute;top:135px;text-align:center;width:100%;">
<div style="padding-left:320px;" class="countdown">
<B ID=CD_hours>00</B><B ID=to>:</B><B ID=CD_mins>00</B><B ID=CD_secs>00</B>
</div></div>
<script>
function st(num){
if (num > 2000) return '0' + (num - 2000);
else if (num < 10) return '0' + num;
else return num;
}
function cd_timer(){
LastSec--;
if (LastSec < 0) {
clearInterval(timer_id);
}
else{
var secs = LastSec % 60;
var temp = Math.floor(LastSec / 60);
var mins = temp % 60;
temp = Math.floor(temp / 60);
var hours = temp % 24;
var days = Math.floor(temp);
document.getElementById('CD_secs').innerHTML = st(secs);
document.getElementById('CD_mins').innerHTML = st(mins);
document.getElementById('CD_hours').innerHTML = st(hours);
}
}
var now = new Date();
var LastSec = 15*60 + 1;
cd_timer();
var timer_id = setInterval(cd_timer, 1000);
</script>
3. lolisant - 01 Апреля, 2009 - 06:27:36 - перейти к сообщению
Furax Спасибо большое, все работает,обратился на один известный форум там не помогли,сюда всегда обращаюсь помогают,форум профи.Еще раз спасибо. Радость

Форум на AlfaSpace.NET


Powered by ExBB
ExBB FM 1.0 RC1 by TvoyWeb.ru
InvisionExBB Style converted by Markus®

[Script Execution time: 0.0206]     [ Gzipped ]