Clicking on the button below modify the date and time shown above
(if JavaScript is enabled).
JavaScript code
function changeElement() {
var elem = document.getElementById("dateTime");
var date = new Date();
elem.innerHTML = "The current time is: " + date.toTimeString();
}
function init() {
changeElement(); // sets time on initial page load
document.getElementById("ChangeButton").onclick = changeElement;
}
window.onload = init;