I can not figure out, for the life of me, why this will not work. All I want to do is drop in the php server side values for the date and time. I saw a similar thread to this, but I had already gotten that far and it didn't help a bit.
Here is what I have:
<script language="JavaScript">
var clockID = 0;
function UpdateClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
var tDate = new Date();
document.theClock.theTime.value = ""
+ <?php echo date('H'); ?> + ":"
+ <?php echo date('i'); ?> + ":"
+ <?php echo date('s'); ?>
clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
clockID = setTimeout("UpdateClock()", 500);
}
function KillClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
}
//-->
</script>
<body onload="StartClock()" onunload="KillClock()">
<center><form name="theClock">
<input type=text name="theTime" size=8>
<form></center>
This works fine if I use javascript to initialize the clock, but if I use the php values like that the clock doesn't move. It just displays the static time in which it was loaded. HELP!