Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <div id=time></div>
- <script type="text/javascript">
- window.onload = function()
- {
- idElement = "time";
- document.getElementById(idElement).innerHTML = "<?php countdown(21,00,00,9,15,2012) ?>" ;
- setInterval("document.getElementById(idElement).innerHTML = '<?php countdown(21,00,00,9,15,2012) ?>'", 1000);
- };
- </script>
- <?php
- function countdown($godzina,$minuta,$sekunda,$miesiac,$dzien,$rok)
- {
- $target = mktime($godzina,$minuta,$sekunda,$miesiac,$dzien,$rok);
- $now = time() ;
- $sekundy =($target-$now) ;
- //$sekundy =(int) ($sekundy) ;
- $check=0;
- if ($sekundy>0)
- {
- if ($check==0)
- {
- if ($sekundy<=10000)
- {
- // zmien klase
- $check=1;
- }
- }
- $hours=floor($sekundy/3600);
- $minutes=floor(($sekundy/60)-($hours*60));
- $seconds=floor(($sekundy)-($hours*3600)-($minutes*60));
- if($hours < 10)
- $hours='0'.$hours;
- if($minutes < 10)
- $minutes='0'.$minutes;
- if ($seconds < 10)
- $seconds='0'.$seconds;
- $all= $hours . " : " . $minutes . " : " . $seconds;
- echo $all;
- }
- else
- {
- echo "Aukcja zakończona!";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement