Quote:
document.body.innerHTML ="<p>" + days + ", " + dates + "/" + months + "/" + years + "</p>";
That line
replaces the entire contents of the
<body>
element with the string you've specified. The
<img>
,
<h2>
, and the two existing
<p>
elements will be removed.
If you want those elements to remain, you need to update the content of a different element instead. For example:
<div>
<h2> TO DO LISTS </h2>
<p> Enter text into the input field to add items to your list (maximum 30 characters) </p>
<p> Click the "X" to remove the item from your list. </p>
<!--
<div id="print-time-output"></div>
</div>
function printTime()
{
...
document.getElementById("print-time-output").innerHTML ="<p>" + days + ", " + dates + "/" + months + "/" + years + "</p>";
}