Free html code for a stopwatch

Asked By 50 points N/A Posted on -
qa-featured

Hello Experts,

I want to put stopwatch in my quiz website, Please support me to find free html code for a stopwatch or any source for free html code for a stopwatch. Thanks.

Regards,   

Donnaa Gordon

SHARE
Best Answer by Toni Linscomb
Answered By 5 points N/A #144985

Free html code for a stopwatch

qa-featured

Hi, Below is the code for Stop Watch.

<html>

<head>

<script type="text/javascript">

var c=0;

var t;

var timer_is_on=0;

function timedCount()

{ document.getElementById('txt').value=c;

c=c+1;

t=setTimeout("timedCount()",1000); }

function doTimer()

{ if (!timer_is_on)

  { timer_is_on=1; timedCount(); }}

function stopCount()

{ clearTimeout(t); timer_is_on=0; }

</script>

</head>

Answered By 0 points N/A #144987

Free html code for a stopwatch

qa-featured
Hello Donnaa Gordon,
 
Here are sample codes about your concern.
You can watch tutorial on Youtube, in additional.
 
<html>
<head>
<script type="text/javascript">
           var c=0;
           var t;
           var timer_is_on=0;
function timedCount()
 
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}
 
function doTimer()
{
if (!timer_is_on)
     {
     timer_is_on=1; timedCount();
      }
}
function stopCount()
{
clearTimeout(t); timer_is_on=0; }
</script>
</head>
</html>
 
Hope this helped you!
Best Answer
Best Answer
Answered By 5 points N/A #144986

Free html code for a stopwatch

qa-featured

 

Try out the following code in below link

 
 
Web page Will Show two buttons and a text box. Two are for start and stop the timer and the textbox will display the time. What happens in the code is you create two functions for start and stop time. Function for start the count will increment a integer variable one by one and once you perform stop function the integer variable will reset to 0.

Related Questions