Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<html> <head> <title> Start and stop a clock </title> </head> <body> <input type

ID: 3547678 • Letter: #

Question

<html>

<head>

<title> Start and stop a clock </title>

</head>

<body>

<input type="text" size= "60" id="theclock" />

<script type="text/javascript">

var setIntervalID = window.setInterval("setClock()",1000);

function setClock()

{

var now = new Date();

document.getElementById("theclock").value=now.toLocaleString();

}

function stopClock()

{

clearIntervalID=window.clearInterval(setIntervalID);

}

</script>

<button>Stop</button>

</body>

</html>

Explanation / Answer

<html>

<head>

<title> Start and stop a clock </title>

</head>

<body>

<input type="text" size= "60" id="theclock" />

<script type="text/javascript">

var setIntervalID = window.setInterval("setClock()",1000);

function setClock()

{

var now = new Date();

document.getElementById("theclock").value=now.toLocaleTimeString();

}

function stopClock()

{

clearIntervalID=window.clearInterval(setIntervalID);

}

</script>

<button>Stop</button>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote