Hi everyone!
I got this piece of code from an earlier post in the forum:
// the php-time-vars are declared earlier
<span id="clock"></span>
<script language="JavaScript">
var entered = new Date();
function time() {
if (!document.layers && !document.all) return
var now = new Date();
var seconds = Math.floor((now.getTime() - entered.getTime()) / 1000) + <?php echo $second ?>;
var minutes = Math.floor(seconds /60) + <?php echo $minute ?>;
var hours = Math.floor(minutes /60) + <?php echo $hour ?>;
var seconds = seconds % 60
var minutes = minutes % 60
var hours = hours % 60
var amorpm = "AM";
if (hours == "24" && minutes == "0" && seconds == "0") reload();
if (hours == "0") hours = 12;
if (hours > 11) amorpm = "PM";
if (hours > 12) hours = hours - 12;
if (hours <= 9) hours = "0" + hours;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
digclock = "" + hours + "<img src='stats/digits/colon.gif'>" + minutes + "<img src='stats/digits/colon.gif'>" + seconds + "";
if (document.layers){
document.layers.clock.document.write(digclock);
document.layers.clock.document.close();
}
else if (document.all) clock.innerHTML = digclock;
setTimeout("time()",1000)
}
window.onload = time;
</script>
No, this works fine and all but it doesn't fit into my site that well. Therefore I thought that I could make it image-based. The problem is, I dont know how to get time (the result of "window.onload = time;") into a php-var so I can split them up and loop out the images.
Or is this a question for the JS-guys maybe?
Any thoughts on how to solve this one?
Thanks
Vasse