html - Javascript setInterval doesn't update timestamp used inside -


i using setinterval in javascript. simple example tried update time displayed.

var tim = new date(); function loadlog(){     document.getelementbyid('timebox').innerhtml=tim.gettime(); } window.setinterval(loadlog, 1000); 

but time not updated. why? how can update variable inside setinterval?

thanks

generate new date each time instead of showing same 1 :

function loadlog(){     var tim = new date();     document.getelementbyid('timebox').innerhtml=tim.gettime(); } window.setinterval(loadlog, 1000); 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -