Parašė WebDraw· 2010 Lie. 18 13:07:51
#9
<?php
//nurodai kada turi atsidaryti
$likosekundziu = mktime(0, 0, 0, 1, 1, 2011)-mktime();
if($likosekundziu >0) {
?>
<script type="text/javascript">
function startTime()
{
if(sec > 60){min = Math.floor(sec/60); sec = sec-min*60;}
if(min >= 60){hour = Math.floor(min/60); min = min-hour*60;}
if(hour >= 24){day = Math.floor(hour/24); hour = hour-day*24;}
if(sec == 0 && min == 0 && hour == 0&& day > 0)
{day -= 1; hour = 60;}
if(sec == 0 && min == 0 && hour > 0)
{hour -= 1; min = 60;}
if(sec == 0 && min > 0)
{min -= 1; sec = 60;}
if(document.getElementById('msg').innerHTML == "")
{document.getElementById('msg').innerHTML = day+" "+hour+":"+min+":"+sec;}
if(sec == 0 && min == 0 && hour == 0 && day == 0)
{document.getElementById('msg').style.color="#00CC00" ;
//parasoma zinute pasibaigus laikui
document.getElementById('msg').innerHTML = "Laikas baigesi!!!!";
location.reload(true);
}else{
sec -= 1;
sec = checkTime(sec);
min = checkTime(min);
document.getElementById('msg').innerHTML = day+" "+hour+":"+min+":"+sec ;
setTimeout('startTime()',1000);
}
}
function checkTime(i)
{
if (i<10 )
{
i = i*1;
i="0" + i;
}
return i;
}
</script>
<script type="text/javascript">
setTimeout('startTime()',500);
day = 0;
hour = 0;
min = 0;
sec = <?= $likosekundziu;?> ;
</script>
<b id='msg'></b>
<?php exit;}?>
kaip nurodyti pasiziurek cia:http://php.net/manual/en/function.mktime.php
koda talpink puslapio virsuje, laikui praejus puslapis uzsikraus
Redagavo WebDraw· 2010 Lie. 18 13:07:41