tcollins412
13 Dec 2010, 07:00 PM
I am writing a javascript program thatyou click the mouse on a button and it shows how many times you have pressed the button. here is the javascript for it
<script language="javascript">
var numcount=0;
function increasecounter(){
numcount++;
document.getElementById('countdiv').innerHTML=numcount;
}
</script>
and here is the html:
<div id='countdiv'>0</div><br/>
<input type=submit onclick="increasecounter();" value="Increment"></br>
<div id='time'></div><div id='score'></div><br/><input type='button' value='reset'>
now with that said, i would like to have a 30 second timer in the 'time' div. and when the timer goes off, i want the counter to stop counting the button clicks and show the score in the 'score' div. then when you click the 'reset' button the timer resets. how would i do this? if somebody could help me that would be GREATLY appreciated
<script language="javascript">
var numcount=0;
function increasecounter(){
numcount++;
document.getElementById('countdiv').innerHTML=numcount;
}
</script>
and here is the html:
<div id='countdiv'>0</div><br/>
<input type=submit onclick="increasecounter();" value="Increment"></br>
<div id='time'></div><div id='score'></div><br/><input type='button' value='reset'>
now with that said, i would like to have a 30 second timer in the 'time' div. and when the timer goes off, i want the counter to stop counting the button clicks and show the score in the 'score' div. then when you click the 'reset' button the timer resets. how would i do this? if somebody could help me that would be GREATLY appreciated