I am having a problem with an HTML5 form field, I need the field (time) to update each second to the current time, the update code is called every second via a setInterval, the HTML5 form element :
<form name="process">
<input name="p_time" type="time" value="<?php echo date("H:i:s");?>" />
//...
</form>
when I try to update : document.forms.process.p_time.value = current.time.slice(17,25); the display remains at the setting made by PHP, the type of string data is the same format of 00:00:00 but it refuses to budge from that original time. the variable current.time is a string of the UTC format corresponding to : ddd, dd mmm, yyyy hh:mm:ss +00:00 GMT variety.
The javascript is a simple routine, it updates a
element in the full version
current = {
now:function(){ return new Date(); },
time:0,
tick:function(){
current.time = current.now().toUTCString();
document.forms.process.p_time.value = current.time.slice(17,25);
current.clock();
},
clock:function(){
current.target.innerHTML = current.time.slice(0,25);
},
auto:setInterval(current.tick,1000)
}
What I don't want to have to do is to have the page refreshed by a page refresh.