People I got from a friend here of the forum a script of a button with countdown, that upon clicking if the count begins. Thank you very much because it is very good ... there is only one problem, when I click more than once on the button the countdown accelerates, see the code ↓
<script language="JavaScript">
function dispara( span ) {
conta( this, document.getElementById( span ) );
}
function conta( botao, contador ) {
botao.disabled=true;
if(contador.innerHTML==0) {
contador.innerHTML = 10;
botao.disabled=false;
return false;
}
contador.innerHTML = contador.innerHTML - 1;
setTimeout( function(){conta( botao, contador )}, 1000 );
}
</script>
<input type="button" value="botao1" onclick="dispara('s1')" class="btn">
<span id="s1">10</span>
<br/><br/>
<input type="button" value="botao2" onclick="dispara('s2')" class="btn">
<span id="s2">10</span>
Could you help me solve this problem?