Example of changing the content of an element The current time is: Code: function changeElement() { var elem = document.getElementById("dateTime"); var date = new Date(); elem.innerHTML = "The current time is: " + date.toTimeString(); } function init() { setInterval(changeElement, 1000); } window.onload = init;