This page is a JavaScript example that prints the current time.
to show time.
First, the “Click Me” button is a plain HTML tag, like this:
<p><button id="id39018">Click Me</button> to show time.</p>
The JavaScript is like this:
function myGetTime() { var dd = new Date(); var hh = dd.getHours(); var mm = dd.getMinutes(); var ss = dd.getSeconds(); alert("The time is now: " + hh + ":" + mm + ":" + ss); } document.getElementById("id39018").onclick = myGetTime;