What is the difference between this function:
function printTime(){
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
document.write(hours+":"+minutes+":"+seconds+"<br />");
}
setInterval('printTime()', 1000);
And this function:
function test(){
document.getElementById("date").innerHTML = Date();
}
setInterval('test()', 1000);
Which prevents "printTime" from actively writing to the page (rather than only firing once), while "test" is capable of functioning as it should?
From all of my experimenting, I've found it to only work when the previous installment was removed or updated (i.e. innerHTML). Is this the case, or am I doing something wrong?