now = new Date(); dif = now.getTime() - $now*1000; function updateTime() { now = new Date(); now.setTime(now.getTime() - dif); var hour = now.getHours(); if(hour < 10) hour = "0" + hour; var minute = now.getMinutes(); if(minute < 10) minute = "0" + minute; var second = now.getSeconds(); if(second < 10) second = "0" + second; document.forms[0].elements[0].value = hour +":"+ minute +":"+ second; } setInterval("updateTime()",1000); ENDHTML; /* ------------------------- */ ?>