H there this is my first post! I wanted to ask if anyone could come up with something to solve my quite simple program. With the following code you can program a simple stopwatch, what I want to add is a button than when the stopwatch is stopped, and you click, that the recorded time is recorded and displayed elsewhere (without reloding)
the code is the following…
[code]
<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>
<body>
<form>
<input type=”button” value=”Start count!” onClick=”doTimer()”>
<input type=”text” id=”txt”>
<input type=”button” value=”Stop count!” onClick=”stopCount()”>
</form>
</body>
</html>
I´m aware im quite a newbie to all this and that my question is quite simple and maybe to vague but I hope you can help me anyways
Cheers to you all and thanks in advance
Trufa