merhaba arkadaşlar server saatini gösteren javascript arıyorum serverdaki saati anlık gösterecek yani saniye saniye dakika dakika sayfayı yenilemeden ilerleyecek
Cut & Paste Live Server Time script (SSI or PHP)
burda bir tane buldum ama çalışmıyor burdaki gibi arkası transparan bir js arıyorum paylaşırsanız sevinirim teşekkürler
Server saati javascripti (istek)
7
●1.329
- 01-12-2008, 12:46:10Live Clock scripti işinize yarayabilir. Zaman zaman bir kaç sitede kullandığım ve çok beğendiğim bir script.
- 13-12-2008, 14:55:57Server Site Clock
<html>
<script type="text/javascript">
function clock(format)
{
//I chose a div as the container for the timer, but
//it can be an input tag inside a form, or anything
//who's displayed content can be changed through
//client-side scripting.
html_code = '<div id="clock"></div>';
document.write(html_code);
Today = new Date();
Todays_Year = Today.getYear() - 2000;
Todays_Month = Today.getMonth() + 1;
<?
$date = getDate();
$second = $date["seconds"];
$minute = $date["minutes"];
$hour = $date["hours"];
$day = $date["mday"];
$month = $date["mon"];
$month_name = $date["month"];
$year = $date["year"];
?>
//Computes the time difference between the client computer and the server.
Server_Date = (new Date(<?= $year - 2000 ?>, <?= $month ?>, <?= $day ?>,
<?= $hour ?>, <?= $minute ?>, <?= $second ?>)).getTime();
Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();
tick((Todays_Date - Server_Date), format);
}
function tick(time_difference, format)
{
Today = new Date(new Date().getTime() - time_difference);
minutes = Today.getMinutes();
if(minutes < 10)
minutes = '0' + minutes;
seconds = Today.getSeconds();
if(seconds < 10)
seconds = '0' + seconds;
months = new Array('Ocak',
'Şubat',
'Mart',
'Nisan',
'Mayıs',
'Haziran',
'Temmuz',
'Ağustos',
'Eylül',
'Ekim',
'Kasım',
'Aralık');
switch(format)
{
case 0:
document.all.clock.innerHTML = Today.getDate() + ' ' +
months[Today.getMonth()] +' ' +
Today.getYear() + ' ' +
Today.getHours() + ':' +
minutes + ':' +
seconds;
break;
case 1:
document.all.clock.innerHTML = Today.getDate() + '-' +
(Today.getMonth() + 1) + '-' +
Today.getYear() + ' ' +
Today.getHours() + ':' +
minutes + ':' +
seconds;
break;
default:
document.all.clock.innerHTML = months[Today.getMonth()] + ' ' +
Today.getDate() + ', ' +
Today.getYear() + ' ' +
Today.getHours() + ':' +
minutes + ':' +
seconds;
}
//Recursive call, keeps the clock ticking.
setTimeout('tick(' + time_difference + ', ' + format + ');', 1000);
}
</script>
<body>
<script type="text/javascript">clock(0);</script>
</body>
</html>